Class ImmutablePartition<K,V>

java.lang.Object
org.moeaframework.analysis.stream.ImmutablePartition<K,V>
Type Parameters:
K - the type of each key
V - the type of each value
All Implemented Interfaces:
Partition<K,V>, Displayable, Formattable<org.apache.commons.lang3.tuple.Pair<K,V>>
Direct Known Subclasses:
Groups

public class ImmutablePartition<K,V> extends Object implements Partition<K,V>
A partition storing the intermediate, materialized content of the stream.
  • Constructor Details

    • ImmutablePartition

      public ImmutablePartition()
      Constructs a new, empty partition.
    • ImmutablePartition

      public ImmutablePartition(List<org.apache.commons.lang3.tuple.Pair<K,V>> list)
      Constructs a new partition with the given content.
      Parameters:
      list - the list of key-value pairs
    • ImmutablePartition

      public ImmutablePartition(Stream<org.apache.commons.lang3.tuple.Pair<K,V>> stream)
      Constructs a new partition with the given content.
      Parameters:
      stream - the stream of key-value pairs
    • ImmutablePartition

      public ImmutablePartition(Iterable<org.apache.commons.lang3.tuple.Pair<K,V>> iterable)
      Constructs a new partition with the given content.
      Parameters:
      iterable - the iterable of key-value pairs
  • Method Details

    • size

      public int size()
      Description copied from interface: Partition
      Returns the number of key-value pairs in this partition.
      Specified by:
      size in interface Partition<K,V>
      Returns:
      the number of items
    • stream

      public Stream<org.apache.commons.lang3.tuple.Pair<K,V>> stream()
      Description copied from interface: Partition
      Returns a Stream of the key-value pairs in this partition.
      Specified by:
      stream in interface Partition<K,V>
      Returns:
      the stream