Class Batch<P>

  • Type Parameters:
    P - type of the record's payload
    All Implemented Interfaces:
    java.lang.Iterable<Record<P>>

    public class Batch<P>
    extends java.lang.Object
    implements java.lang.Iterable<Record<P>>
    Class representing a batch of records.
    Author:
    Mahmoud Ben Hassine ([email protected])
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addRecord​(Record<P> record)
      Add a record to the batch.
      boolean equals​(java.lang.Object o)  
      int hashCode()  
      boolean isEmpty()
      Check if the batch is empty.
      java.util.Iterator<Record<P>> iterator()  
      void removeRecord​(Record<P> record)
      Remove a record from the batch.
      long size()
      Get the size of the batch.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Constructor Detail

      • Batch

        public Batch()
        Create a new Batch.
      • Batch

        public Batch​(Record<P>... records)
        Create a new Batch.
        Parameters:
        records - to put in the batch
      • Batch

        public Batch​(java.util.List<Record<P>> records)
        Create a new Batch.
        Parameters:
        records - to put in the batch
    • Method Detail

      • addRecord

        public void addRecord​(Record<P> record)
        Add a record to the batch.
        Parameters:
        record - to add
      • removeRecord

        public void removeRecord​(Record<P> record)
        Remove a record from the batch.
        Parameters:
        record - to remove
      • isEmpty

        public boolean isEmpty()
        Check if the batch is empty.
        Returns:
        true if the batch is empty, false otherwise
      • size

        public long size()
        Get the size of the batch.
        Returns:
        the size of the batch
      • equals

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

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

        public java.util.Iterator<Record<P>> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<P>
      • toString

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