public class WLongArrayList extends it.unimi.dsi.fastutil.longs.LongArrayList implements WArrayList<org.apache.hadoop.io.LongWritable>, WLongCollection
Modifier and Type | Class and Description |
---|---|
static class |
WLongArrayList.WReusableLongArrayList
Variant of WLongArrayList that doesn't reallocate smaller backing
array on consecutive readFields/readElements calls, and so is suitable for
reusable use.
|
Constructor and Description |
---|
WLongArrayList()
Creates a new array list with
LongArrayList.DEFAULT_INITIAL_CAPACITY capacity. |
WLongArrayList(int capacity)
Creates a new array list with given capacity.
|
WLongArrayList(it.unimi.dsi.fastutil.longs.LongCollection c)
Creates a new array list and fills it with a given type-specific
collection.
|
WLongArrayList(it.unimi.dsi.fastutil.longs.LongList l)
Creates a new array list and fills it with a given type-specific list.
|
Modifier and Type | Method and Description |
---|---|
void |
addW(org.apache.hadoop.io.LongWritable value)
Add value to the collection
|
int |
capacity()
Capacity of currently allocated memory
|
void |
fastForEachW(Consumer<org.apache.hadoop.io.LongWritable> f)
Traverse all elements of the collection, calling given function on each
element.
|
boolean |
fastForEachWhileW(Predicate<org.apache.hadoop.io.LongWritable> f)
Traverse all elements of the collection, calling given function on each
element, or until predicate returns false.
|
ResettableIterator<org.apache.hadoop.io.LongWritable> |
fastIteratorW()
Fast iterator over collection objects, which doesn't allocate new
element for each returned element, and can be iterated multiple times
using reset().
|
ResettableIterator<org.apache.hadoop.io.LongWritable> |
fastIteratorW(org.apache.hadoop.io.LongWritable iterationValue)
Fast iterator over collection objects, which doesn't allocate new
element for each returned element, and can be iterated multiple times
using reset().
|
void |
fillW(int from,
int to,
org.apache.hadoop.io.LongWritable value)
Sets given range of elements to a specified value.
|
void |
forEachLong(LongConsumer f)
Traverse all elements of the array list, calling given function on each
element, or until predicate returns false.
|
boolean |
forEachWhileLong(LongPredicate f)
Traverse all elements of the array list, calling given function on each
element.
|
PrimitiveTypeOps<org.apache.hadoop.io.LongWritable> |
getElementTypeOps()
TypeOps for type of elements this object holds
|
void |
getIntoW(int index,
org.apache.hadoop.io.LongWritable to)
Get element at given index in the array, storing it into 'to' argument
|
void |
popIntoW(org.apache.hadoop.io.LongWritable to)
Pop value from the end of the array, storing it into 'to' argument
|
void |
readElements(DataInput in,
int size)
Read elements from DataInput stream, with passing the size instead
reading it from the stream.
|
void |
readFields(DataInput in) |
static WLongArrayList |
readNew(DataInput in)
Read array list from the DataInput stream into a newly created object.
|
protected void |
resizeArrayForRead(int size)
Resize array for reading given number of elements.
|
void |
setCapacity(int n)
Forces allocated memory to hold exactly N values
|
void |
setW(int index,
org.apache.hadoop.io.LongWritable value)
Set element at given index in the array
|
void |
sort()
Sort the array in ascending order
|
void |
write(DataOutput out) |
void |
writeElements(DataOutput out)
Write elements to the DataOutput stream, without the size itself.
|
static void |
writeOrNull(WLongArrayList list,
DataOutput out)
Write a potentially null list to a DataOutput.
|
add, add, addAll, addAll, addElements, clear, clone, compareTo, elements, ensureCapacity, equals, getElements, getLong, indexOf, isEmpty, lastIndexOf, listIterator, rem, removeElements, removeLong, set, size, size, toLongArray, trim, trim, wrap, wrap
add, addAll, addAll, addAll, addAll, addElements, compareTo, contains, ensureIndex, ensureRestrictedIndex, equals, get, hashCode, indexOf, iterator, lastIndexOf, listIterator, longListIterator, longListIterator, longSubList, peek, peekLong, pop, popLong, push, push, remove, remove, set, subList, top, topLong, toString
add, contains, containsAll, containsAll, longIterator, rem, removeAll, removeAll, retainAll, retainAll, toArray, toArray, toArray, toLongArray
finalize, getClass, notify, notifyAll, wait, wait, wait
size, trim
clear, size
add, addAll, contains, containsAll, iterator, longIterator, rem, removeAll, retainAll, toArray, toArray, toLongArray, toLongArray
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray
add, contains, containsAll, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
public WLongArrayList()
LongArrayList.DEFAULT_INITIAL_CAPACITY
capacity.public WLongArrayList(int capacity)
capacity
- the initial capacity of the array list (may be 0).public WLongArrayList(it.unimi.dsi.fastutil.longs.LongCollection c)
c
- a type-specific collection that will be used to fill the array
list.public WLongArrayList(it.unimi.dsi.fastutil.longs.LongList l)
l
- a type-specific list that will be used to fill the array list.public PrimitiveTypeOps<org.apache.hadoop.io.LongWritable> getElementTypeOps()
WCollection
getElementTypeOps
in interface WCollection<org.apache.hadoop.io.LongWritable>
public int capacity()
WCollection
capacity
in interface WCollection<org.apache.hadoop.io.LongWritable>
public void setCapacity(int n)
WCollection
setCapacity
in interface WCollection<org.apache.hadoop.io.LongWritable>
n
- new capacitypublic void addW(org.apache.hadoop.io.LongWritable value)
WCollection
addW
in interface WCollection<org.apache.hadoop.io.LongWritable>
value
- Valuepublic void getIntoW(int index, org.apache.hadoop.io.LongWritable to)
WArrayList
getIntoW
in interface WArrayList<org.apache.hadoop.io.LongWritable>
index
- Indexto
- Object to store value intopublic void popIntoW(org.apache.hadoop.io.LongWritable to)
WArrayList
popIntoW
in interface WArrayList<org.apache.hadoop.io.LongWritable>
to
- Object to store value intopublic void setW(int index, org.apache.hadoop.io.LongWritable value)
WArrayList
setW
in interface WArrayList<org.apache.hadoop.io.LongWritable>
index
- Indexvalue
- Valuepublic void fillW(int from, int to, org.apache.hadoop.io.LongWritable value)
WArrayList
fillW
in interface WArrayList<org.apache.hadoop.io.LongWritable>
from
- From index (inclusive)to
- To index (exclusive)value
- Valuepublic ResettableIterator<org.apache.hadoop.io.LongWritable> fastIteratorW()
WCollection
fastIteratorW
in interface WCollection<org.apache.hadoop.io.LongWritable>
public ResettableIterator<org.apache.hadoop.io.LongWritable> fastIteratorW(org.apache.hadoop.io.LongWritable iterationValue)
WCollection
fastIteratorW
in interface WCollection<org.apache.hadoop.io.LongWritable>
iterationValue
- Value that call to next() will populatepublic void fastForEachW(Consumer<org.apache.hadoop.io.LongWritable> f)
WCollection
fastForEachW
in interface WCollection<org.apache.hadoop.io.LongWritable>
f
- Function to call on each element.public boolean fastForEachWhileW(Predicate<org.apache.hadoop.io.LongWritable> f)
WCollection
fastForEachWhileW
in interface WCollection<org.apache.hadoop.io.LongWritable>
f
- Function to call on each element.public void forEachLong(LongConsumer f)
forEachLong
in interface WLongCollection
f
- Function to call on each element.public boolean forEachWhileLong(LongPredicate f)
forEachWhileLong
in interface WLongCollection
f
- Function to call on each element.public void sort()
WArrayList
sort
in interface WArrayList<org.apache.hadoop.io.LongWritable>
public void writeElements(DataOutput out) throws IOException
WCollection
writeElements
in interface WCollection<org.apache.hadoop.io.LongWritable>
out
- Data outputIOException
public void write(DataOutput out) throws IOException
write
in interface org.apache.hadoop.io.Writable
IOException
public void readElements(DataInput in, int size) throws IOException
WCollection
readElements
in interface WCollection<org.apache.hadoop.io.LongWritable>
in
- Data Inputsize
- Number of elementsIOException
protected void resizeArrayForRead(int size)
size
- Number of elements that will be read.public void readFields(DataInput in) throws IOException
readFields
in interface org.apache.hadoop.io.Writable
IOException
public static void writeOrNull(WLongArrayList list, DataOutput out) throws IOException
list
- Array list to be writtenout
- Data outputIOException
public static WLongArrayList readNew(DataInput in) throws IOException
in
- Data inputIOException
Copyright © 2011-2020 The Apache Software Foundation. All Rights Reserved.