Class ThreadSafeArray<X>

java.lang.Object
io.github.ai4ci.util.ThreadSafeArray<X>
Type Parameters:
X - the array type
All Implemented Interfaces:
Serializable

public class ThreadSafeArray<X> extends Object implements Serializable
A write once read many times list like data structure. This allows multi-threaded writing to the array and multi-threaded reading and largely assumes they happen in different phases.
See Also:
  • Constructor Details

    • ThreadSafeArray

      public ThreadSafeArray(Class<X> type, int size)
  • Method Details

    • empty

      public static <Y> ThreadSafeArray<Y> empty(Class<Y> type)
    • put

      public int put(X value)
    • finish

      public X[] finish()
    • get

      public X get(int p)
    • stream

      public Stream<X> stream()
    • parallelStream

      public Stream<X> parallelStream()
    • size

      public int size()
    • isEmpty

      public boolean isEmpty()