public abstract class AbstractReplicaCollection<C extends AbstractReplicaCollection<C>> extends java.lang.Object implements ReplicaCollection<C>
| Modifier and Type | Class and Description |
|---|---|
protected static class |
AbstractReplicaCollection.ReplicaList
A simple list with no comodification checks and immutability by default (only append permitted, and only one initial copy)
this permits us to reduce the amount of garbage generated, by not wrapping iterators or unnecessarily copying
and reduces the amount of indirection necessary, as well as ensuring monomorphic callsites
|
protected static class |
AbstractReplicaCollection.ReplicaMap<K>
A simple map that ensures the underlying list's iteration order is maintained, and can be shared with
subLists (either produced via subList, or via filter that naturally produced a subList).
|
ReplicaCollection.Builder<C extends ReplicaCollection<C>>| Modifier and Type | Field and Description |
|---|---|
protected static AbstractReplicaCollection.ReplicaList |
EMPTY_LIST |
protected AbstractReplicaCollection.ReplicaList |
list |
| Modifier and Type | Method and Description |
|---|---|
static <C extends ReplicaCollection<C>,B extends ReplicaCollection.Builder<C>> |
collector(java.util.Set<java.util.stream.Collector.Characteristics> characteristics,
java.util.function.Supplier<B> supplier) |
int |
count(java.util.function.Predicate<Replica> predicate)
|
boolean |
equals(java.lang.Object o)
It's not clear whether
AbstractReplicaCollection should implement the order sensitive equals
of List or the order oblivious equals of Set. |
C |
filter(java.util.function.Predicate<Replica> predicate)
|
C |
filter(java.util.function.Predicate<Replica> predicate,
int limit)
|
java.lang.Iterable<Replica> |
filterLazily(java.util.function.Predicate<Replica> predicate)
|
java.lang.Iterable<Replica> |
filterLazily(java.util.function.Predicate<Replica> predicate,
int limit)
|
Replica |
get(int i) |
int |
hashCode()
It's not clear whether
AbstractReplicaCollection should implement the order sensitive hashCode
of List or the order oblivious equals of Set. |
boolean |
isEmpty() |
java.util.Iterator<Replica> |
iterator() |
abstract ReplicaCollection.Builder<C> |
newBuilder(int initialCapacity)
construct a new Builder of our own type, so that we can concatenate
TODO: this isn't terribly pretty, but we need sometimes to select / merge two Endpoints of unknown type;
|
int |
size() |
abstract C |
snapshot() |
C |
sorted(java.util.Comparator<Replica> comparator)
|
java.util.stream.Stream<Replica> |
stream() |
C |
subList(int start,
int end)
|
java.lang.String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitcontains, endpointsprotected static final AbstractReplicaCollection.ReplicaList EMPTY_LIST
protected final AbstractReplicaCollection.ReplicaList list
public static <C extends ReplicaCollection<C>,B extends ReplicaCollection.Builder<C>> java.util.stream.Collector<Replica,B,C> collector(java.util.Set<java.util.stream.Collector.Characteristics> characteristics, java.util.function.Supplier<B> supplier)
public abstract ReplicaCollection.Builder<C> newBuilder(int initialCapacity)
public abstract C snapshot()
public final C subList(int start, int end)
subList in interface ReplicaCollection<C extends AbstractReplicaCollection<C>>public int count(java.util.function.Predicate<Replica> predicate)
count in interface ReplicaCollection<C extends AbstractReplicaCollection<C>>public final C filter(java.util.function.Predicate<Replica> predicate)
filter in interface ReplicaCollection<C extends AbstractReplicaCollection<C>>public final C filter(java.util.function.Predicate<Replica> predicate, int limit)
filter in interface ReplicaCollection<C extends AbstractReplicaCollection<C>>public final java.lang.Iterable<Replica> filterLazily(java.util.function.Predicate<Replica> predicate)
filterLazily in interface ReplicaCollection<C extends AbstractReplicaCollection<C>>public final java.lang.Iterable<Replica> filterLazily(java.util.function.Predicate<Replica> predicate, int limit)
filterLazily in interface ReplicaCollection<C extends AbstractReplicaCollection<C>>public final C sorted(java.util.Comparator<Replica> comparator)
sorted in interface ReplicaCollection<C extends AbstractReplicaCollection<C>>public final Replica get(int i)
get in interface ReplicaCollection<C extends AbstractReplicaCollection<C>>i - a value in the range [0..size())public final int size()
size in interface ReplicaCollection<C extends AbstractReplicaCollection<C>>public final boolean isEmpty()
isEmpty in interface ReplicaCollection<C extends AbstractReplicaCollection<C>>public final java.util.Iterator<Replica> iterator()
iterator in interface java.lang.Iterable<Replica>iterator in interface ReplicaCollection<C extends AbstractReplicaCollection<C>>public final java.util.stream.Stream<Replica> stream()
stream in interface ReplicaCollection<C extends AbstractReplicaCollection<C>>public final boolean equals(java.lang.Object o)
It's not clear whether AbstractReplicaCollection should implement the order sensitive equals
of List or the order oblivious equals of Set. We never rely on equality
in the database so rather then leave in a potentially surprising implementation we have it throw UnsupportedOperationException.
Don't implement this and pick one behavior over the other. If you want equality you can static import Iterables.elementsEqual(Iterable, Iterable)
and use that to get order sensitive equals.
equals in interface ReplicaCollection<C extends AbstractReplicaCollection<C>>equals in class java.lang.Objectpublic final int hashCode()
It's not clear whether AbstractReplicaCollection should implement the order sensitive hashCode
of List or the order oblivious equals of Set. We never rely on hashCode
in the database so rather then leave in a potentially surprising implementation we have it throw UnsupportedOperationException.
Don't implement this and pick one behavior over the other.
hashCode in interface ReplicaCollection<C extends AbstractReplicaCollection<C>>hashCode in class java.lang.Objectpublic final java.lang.String toString()
toString in interface ReplicaCollection<C extends AbstractReplicaCollection<C>>toString in class java.lang.ObjectCopyright © 2009-2020 The Apache Software Foundation