Class ConcurrentRecordList

java.lang.Object
com.northconcepts.datapipeline.core.RecordList
com.northconcepts.datapipeline.core.ConcurrentRecordList
All Implemented Interfaces:
JsonSerializable, RecordSerializable, Serializable, Cloneable, Iterable<Record>

public class ConcurrentRecordList extends RecordList
A RecordList that guards many of its methods with a read-write lock; others, such as size() and clear(), are unguarded, as are the iterators, streams and lists it hands out.
See Also:
  • Constructor Details

    • ConcurrentRecordList

      public ConcurrentRecordList()
    • ConcurrentRecordList

      public ConcurrentRecordList(int initialCapacity)
    • ConcurrentRecordList

      public ConcurrentRecordList(Record... records)
    • ConcurrentRecordList

      public ConcurrentRecordList(DataReader reader)
  • Method Details

    • getReadWriteLock

      public ReadWriteLock getReadWriteLock()
      Returns the lock guarding this list, for holding it across several calls or while iterating.
    • iterator

      public Iterator<Record> iterator()
      Description copied from class: RecordList
      Returns an iterator over the records in this list.
      Specified by:
      iterator in interface Iterable<Record>
      Overrides:
      iterator in class RecordList
    • clone

      public ConcurrentRecordList clone()
      Description copied from class: RecordList
      Returns a new RecordList that is a copy of this RecordList.
      Overrides:
      clone in class RecordList
    • getRecords

      public List<Record> getRecords()
      Description copied from class: RecordList
      Returns a list of records.
      Overrides:
      getRecords in class RecordList
    • forEach

      public void forEach(Consumer<? super Record> consumer)
      Description copied from class: RecordList
      Performs the given action for each record in this list.
      Specified by:
      forEach in interface Iterable<Record>
      Overrides:
      forEach in class RecordList
    • stream

      public Stream<Record> stream()
      Description copied from class: RecordList
      Returns a sequential Stream of the records in this list.
      Overrides:
      stream in class RecordList
    • parallelStream

      public Stream<Record> parallelStream()
      Description copied from class: RecordList
      Returns a parallel Stream of the records in this list.
      Overrides:
      parallelStream in class RecordList
    • getRecordCount

      public int getRecordCount()
      Description copied from class: RecordList
      Returns the number of records in this list -- an alias for RecordList.size().
      Overrides:
      getRecordCount in class RecordList
    • get

      public Record get(int index)
      Description copied from class: RecordList
      Returns the record at the specified position in this list.
      Overrides:
      get in class RecordList
    • add

      public RecordList add(Record... records)
      Description copied from class: RecordList
      Appends all the specified records to the end of this list.
      Overrides:
      add in class RecordList
    • add

      public RecordList add(int index, Record record)
      Description copied from class: RecordList
      Inserts a record at the specified position in this list, shifting any record at or after index to the right.
      Overrides:
      add in class RecordList
    • set

      public RecordList set(int index, Record record)
      Description copied from class: RecordList
      Replaces the record at the specified position in this list with a new record.
      Overrides:
      set in class RecordList
    • move

      public RecordList move(int oldIndex, int newIndex)
      Description copied from class: RecordList
      Moves the index field at the oldIndex to the newIndex, shifting any existing elements at or after newIndex to the right.
      Overrides:
      move in class RecordList
    • addAll

      public RecordList addAll(DataReader reader)
      Description copied from class: RecordList
      Writes all the records in the specified reader to the end of this list.
      Overrides:
      addAll in class RecordList
    • sublist

      public RecordList sublist(int fromIndex, int toIndex, boolean cloneRecords)
      Description copied from class: RecordList
      Returns a new list with the records from fromIndex (inclusive) to toIndex (exclusive), cloning each record if cloneRecords is true.
      Overrides:
      sublist in class RecordList
    • sublist

      public RecordList sublist(int fromIndex, boolean cloneRecords)
      Overrides:
      sublist in class RecordList
    • sort

      public RecordList sort(RecordComparator comparator, boolean cacheFieldIndexes)
      Overrides:
      sort in class RecordList
    • sort

      public RecordList sort(RecordComparator comparator)
      Description copied from class: RecordList
      Sorts this list in place with the comparator; the sort is stable.
      Overrides:
      sort in class RecordList
    • findFirst

      public int findFirst(Filter filter, int from)
      Description copied from class: RecordList
      Returns the index of the first record at or after from that the filter allows, or -1 if none; a negative from starts at 0.
      Overrides:
      findFirst in class RecordList
    • findLast

      public int findLast(Filter filter, int from)
      Description copied from class: RecordList
      Returns the index of the last record at or before from that the filter allows, or -1 if none; a from of -1 or past the end starts at the last record.
      Overrides:
      findLast in class RecordList
    • findAll

      public RecordList findAll(Filter filter)
      Description copied from class: RecordList
      Returns a new list with the records the filter allows; the records are shared, not copied.
      Overrides:
      findAll in class RecordList
    • getSizeInBytes

      public long getSizeInBytes()
      Description copied from class: RecordList
      Returns the estimated memory used by this list in bytes, counting the first record's field names once for all records.
      Overrides:
      getSizeInBytes in class RecordList
    • toString

      public String toString()
      Overrides:
      toString in class RecordList