Interface ReplicaCollection<C extends ReplicaCollection<C>>

    • Method Detail

      • endpoints

        java.util.Set<InetAddressAndPort> endpoints()
        Returns:
        a Set of the endpoints of the contained Replicas. Iteration order is maintained where there is a 1:1 relationship between endpoint and Replica Typically this collection offers O(1) access methods, and this is true for all but ReplicaList.
      • get

        Replica get​(int i)
        Parameters:
        i - a value in the range [0..size())
        Returns:
        the i'th Replica, in our iteration order
      • size

        int size()
        Returns:
        the number of Replica contained
      • isEmpty

        boolean isEmpty()
        Returns:
        true iff size() == 0
      • contains

        boolean contains​(Replica replica)
        Returns:
        true iff a Replica in this collection is equal to the provided Replica. Typically this method is expected to take O(1) time, and this is true for all but ReplicaList.
      • count

        int count​(java.util.function.Predicate<? super Replica> predicate)
        Returns:
        the number of replicas that match the predicate
      • filter

        C filter​(java.util.function.Predicate<? super Replica> predicate)
        Returns:
        a *eagerly constructed* copy of this collection containing the Replica that match the provided predicate. An effort will be made to either return ourself, or a subList, where possible. It is guaranteed that no changes to any upstream Builder will affect the state of the result.
      • filter

        C filter​(java.util.function.Predicate<? super Replica> predicate,
                 int maxSize)
        Returns:
        a *eagerly constructed* copy of this collection containing the Replica that match the provided predicate. An effort will be made to either return ourself, or a subList, where possible. It is guaranteed that no changes to any upstream Builder will affect the state of the result. Only the first maxSize items will be returned.
      • filterLazily

        java.lang.Iterable<Replica> filterLazily​(java.util.function.Predicate<? super Replica> predicate)
        Returns:
        a *lazily constructed* Iterable over this collection, containing the Replica that match the provided predicate.
      • filterLazily

        java.lang.Iterable<Replica> filterLazily​(java.util.function.Predicate<? super Replica> predicate,
                                                 int maxSize)
        Returns:
        a *lazily constructed* Iterable over this collection, containing the Replica that match the provided predicate. Only the first maxSize matching items will be returned.
      • subList

        C subList​(int start,
                  int end)
        Returns:
        an *eagerly constructed* copy of this collection containing the Replica at positions [start..end); An effort will be made to either return ourself, or a subList, where possible. It is guaranteed that no changes to any upstream Builder will affect the state of the result.
      • sorted

        C sorted​(java.util.Comparator<? super Replica> comparator)
        Returns:
        an *eagerly constructed* copy of this collection containing the Replica re-ordered according to this comparator It is guaranteed that no changes to any upstream Builder will affect the state of the result.
      • iterator

        java.util.Iterator<Replica> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<C extends ReplicaCollection<C>>
      • stream

        java.util.stream.Stream<Replica> stream()
      • equals

        boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        java.lang.String toString()
        Overrides:
        toString in class java.lang.Object