Top Description Inners Fields Constructors Methods
com.amazon.ion.impl

public final Class _Private_Utils

extends Object
Class Inheritance
Static Imports
com.amazon.ion.SymbolTable.UNKNOWN_SYMBOL_ID, .SystemSymbols.IMPORTS, .SystemSymbols.IMPORTS_SID, .SystemSymbols.ION_SYMBOL_TABLE, .SystemSymbols.MAX_ID, .SystemSymbols.MAX_ID_SID, .SystemSymbols.NAME, .SystemSymbols.NAME_SID, .SystemSymbols.SYMBOLS, .SystemSymbols.SYMBOLS_SID, .SystemSymbols.VERSION, .SystemSymbols.VERSION_SID, com.amazon.ion.util.IonStreamUtils.isIonBinary

NOT FOR APPLICATION USE!

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
_Private_Utils.IntIterator

Private to route clients through the static methods, which can optimize the empty-list case.

private static class
_Private_Utils.StringIterator

Private to route clients through the static methods, which can optimize the empty-list case.

Field Summary

Modifier and TypeField and Description
public static final Charset
public static final String
public static final byte[]
EMPTY_BYTE_ARRAY

Just a zero-length byte array, used to avoid allocation.

public static final int[]
EMPTY_INT_ARRAY

Just a zero-length int array, used to avoid allocation.

public static final ListIterator<?>
public static final String[]
EMPTY_STRING_ARRAY

Just a zero-length String array, used to avoid allocation.

public static final int
MAX_LOOKAHEAD_UTF16

(null.timestamp) requires 11 ASCII chars to distinguish from (null.timestamps) aka (null '.' 'timestamps')

public static final boolean
READER_HASNEXT_REMOVED

Marker for code points relevant to removal of IonReader.hasNext().

public static final TimeZone
UTC

The UTC TimeZone.

public static final Charset
public static final String
UTF8_CHARSET_NAME

The string "UTF-8".

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static <T> void
addAll(Collection<T> dest, Iterator<T> src)

public static <T> void
public static byte[]
convertUtf16UnitsToUtf8(String text)

This differs from utf8(String) by using our custem encoder.

public static SymbolTable

Returns:

a new mutable SymbolTable instance; not null
copyLocalSymbolTable
(SymbolTable symtab)

Creates a mutable copy of this local symbol table.

public static byte[]
copyOf(byte[] original, int newLength)

Replacement for Java6 Arrays#copyOf(byte[], int).

public static String[]
copyOf(String[] original, int newLength)

public static String

Returns:

the decoded string, not null.
decode
(byte[]
the data to decode.
bytes
,
Charset charset)

Decodes a byte sequence into a string, given a Charset.

public static final <T> ListIterator<T>
public static byte[]

Returns:

the encoded string, not null.
encode
(String
the string to encode.
s
,
Charset charset)

Encodes a String into bytes of a given encoding.

public static final int
getSidForSymbolTableField(String text)

Returns the symbol ID matching a system symbol text of a local or shared symtab field.

public static SymbolTable
initialSymtab(_Private_LocalSymbolTableFactory
the factory to use to build the local symbol table, never null
lstFactory
,
SymbolTable
the default system symtab, which will be used if the first import in imports isn't a system symtab, never null
defaultSystemSymtab
,
SymbolTable...
the set of shared symbol tables to import; may be null or empty. The first (and only the first) may be a system table, in which case the defaultSystemSymtab is ignored.
imports
)

Returns a minimal symtab that, either system or local depending on the given values, that supports representation as an IonStruct.

public static final Iterator<Integer>
intIterator(int... values)

public static final Iterator<Integer>
intIterator(int[] values, int len)

public static boolean
isNonSymbolScalar(IonType type)

Determines whether the passed-in data type is a scalar and not a symbol.

public static boolean
isTrivialTable(SymbolTable table)

Is the table null, system, or local without imported symbols?

public static Iterator<IonValue>
iterate(ValueFactory valueFactory, IonReader input)

Create a value iterator from a reader.

public static byte[]
public static String
public static byte[]
public static SymbolToken
public static void
localize(SymbolTable symtab, SymbolToken[]
may be mutated, replacing entries with localized updates!
syms
,
int count)

public static void
localize(SymbolTable symtab, SymbolToken[]
may be mutated, replacing entries with localized updates!
syms
)

private static boolean
localSymtabExtends(SymbolTable superset, SymbolTable subset)

Determines, for two local symbol tables, whether the passed-in superset symtab is an extension of subset.

public static _Private_LocalSymbolTableFactory
newLocalSymbolTableAsStructFactory(ValueFactory
the ValueFactory from which to construct the IonStruct representation of the LST
imageFactory
)
Deprecated due to DOM entanglement. Streaming applications should use LocalSymbolTable#DEFAULT_LST_FACTORY.

Trampoline to LocalSymbolTableAsStruct.Factory#Factory(ValueFactory)

public static SymbolTable
public static SymbolTable
newSharedSymtab(IonReader reader, boolean alreadyInStruct)

public static SymbolTable
newSharedSymtab(String name, int version, SymbolTable
may be null.
priorSymtab
,
Iterator<String> symbols)

As per IonSystem#newSharedSymbolTable(String, int, Iterator, SymbolTable...), any duplicate or null symbol texts are skipped.

public static SymbolTable
newSubstituteSymtab(SymbolTable original, int version, int maxId)

public static SymbolTokenImpl

Returns:

not null
newSymbolToken
(String text, int sid)

public static SymbolTokenImpl

Returns:

not null
newSymbolToken
(int sid)

public static SymbolToken

Returns:

not null
newSymbolToken
(SymbolTable symtab, String text)

Checks symbol content.

public static SymbolToken

Returns:

not null
newSymbolToken
(SymbolTable symtab, int sid)

public static SymbolToken[]

Returns:

not null.
newSymbolTokens
(SymbolTable symtab, String...
may be null or empty.
text
)

Validates each text element.

public static SymbolToken[]

Returns:

not null.
newSymbolTokens
(SymbolTable symtab, int...
may be null or empty.
syms
)

public static int

Returns:

the number of bytes read from the stream. May be less than buf.length if EOF is encountered before reading that far.
readFully
(InputStream
The stream to read from.
in
,
byte[]
The buffer to read to.
buf
)

Calls InputStream#read(byte[], int, int) until the buffer is filled or EOF is encountered.

public static int

Returns:

the number of bytes read from the stream. May be less than length if EOF is encountered before reading that far.
readFully
(InputStream
The stream to read from.
in
,
byte[]
The buffer to read to.
buf
,
int
The offset of the buffer to read from.
offset
,
int
The length of the data to read.
length
)

Calls InputStream#read(byte[], int, int) until the requested length is read or EOF is encountered.

public static boolean
public static boolean
public static final Iterator<String>
public static final Iterator<String>
stringIterator(String[] values, int len)

public static boolean

Returns:

true if superset extends subset, false if not
symtabExtends
(SymbolTable
either a system or local symbol table
superset
,
SymbolTable
either a system or local symbol table
subset
)

Determines whether the passed-in superset symtab is an extension of subset.

public static boolean
public static final boolean
symtabIsSharedNotSystem(SymbolTable symtab)

Indicates whether a table is shared but not a system table.

public static IonStruct
symtabTree(SymbolTable symtab, ValueFactory valueFactory)

public static SymbolTable
systemSymtab(int version)

public static int[]
toSids(SymbolToken[] symbols, int count)

public static String[]

Returns:

not null.
toStrings
(SymbolToken[] symbols, int count)

Extracts the non-null text from a list of symbol tokens.

public static byte[]

Returns:

the encoded UTF-8 bytes, not null.
utf8
(String
the string to encode.
s
)

Encodes a String into UTF-8 bytes.

public static String

Returns:

the decoded string, not null.
utf8
(byte[]
the data to decode.
bytes
)

Decodes a UTF-8 byte sequence to a String.

public static String
public static boolean

Returns:

boolean true if v can be a local symbol table otherwise false
valueIsLocalSymbolTable
(_Private_IonValue v)

Checks the passed in value and returns whether or not the value could be a local symbol table.

public static void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ASCII_CHARSETback to summary
public static final Charset ASCII_CHARSET
ASCII_CHARSET_NAMEback to summary
public static final String ASCII_CHARSET_NAME
EMPTY_BYTE_ARRAYback to summary
public static final byte[] EMPTY_BYTE_ARRAY

Just a zero-length byte array, used to avoid allocation.

EMPTY_INT_ARRAYback to summary
public static final int[] EMPTY_INT_ARRAY

Just a zero-length int array, used to avoid allocation.

EMPTY_ITERATORback to summary
public static final ListIterator<?> EMPTY_ITERATOR
EMPTY_STRING_ARRAYback to summary
public static final String[] EMPTY_STRING_ARRAY

Just a zero-length String array, used to avoid allocation.

MAX_LOOKAHEAD_UTF16back to summary
public static final int MAX_LOOKAHEAD_UTF16

(null.timestamp) requires 11 ASCII chars to distinguish from (null.timestamps) aka (null '.' 'timestamps')

See Also
IonCharacterReader#DEFAULT_BUFFER_SIZE, IonCharacterReader#BUFFER_PADDING
READER_HASNEXT_REMOVEDback to summary
public static final boolean READER_HASNEXT_REMOVED

Marker for code points relevant to removal of IonReader.hasNext().

UTCback to summary
public static final TimeZone UTC

The UTC TimeZone. TODO determine if this is well-defined.

UTF8_CHARSETback to summary
public static final Charset UTF8_CHARSET
UTF8_CHARSET_NAMEback to summary
public static final String UTF8_CHARSET_NAME

The string "UTF-8".

Constructor Detail

_Private_Utilsback to summary
public _Private_Utils()

Method Detail

addAllback to summary
public static <T> void addAll(Collection<T> dest, Iterator<T> src)
addAllNonNullback to summary
public static <T> void addAllNonNull(Collection<T> dest, Iterator<T> src)
convertUtf16UnitsToUtf8back to summary
public static byte[] convertUtf16UnitsToUtf8(String text)

This differs from utf8(String) by using our custem encoder. Not sure which is better. TODO benchmark the two approaches

copyLocalSymbolTableback to summary
public static SymbolTable copyLocalSymbolTable(SymbolTable symtab) throws SubstituteSymbolTableException

Creates a mutable copy of this local symbol table. The cloned table will be created in the context of the same ValueFactory.

Note that the resulting symbol table holds a distinct, deep copy of the given table, adding symbols on either instances will not modify the other.

Returns:SymbolTable

a new mutable SymbolTable instance; not null

Exceptions
SubstituteSymbolTableException:
if any imported table by the given local symbol table is a substituted table (whereby no exact match was found in its catalog)
IllegalArgumentException:
if the given table is not a local symbol table
copyOfback to summary
public static byte[] copyOf(byte[] original, int newLength)

Replacement for Java6 Arrays#copyOf(byte[], int).

copyOfback to summary
public static String[] copyOf(String[] original, int newLength)
decodeback to summary
public static String decode(byte[] bytes, Charset charset)

Decodes a byte sequence into a string, given a Charset.

This method is preferred to Charset#decode(ByteBuffer) and String#String(byte[], Charset) (etc.) since those methods will replace or ignore bad input, and here we throw an exception.

Parameters
bytes:byte[]

the data to decode.

Returns:String

the decoded string, not null.

Exceptions
IonException:
if there's a CharacterCodingException.
emptyIteratorback to summary
public static final <T> ListIterator<T> emptyIterator()
Annotations
@SuppressWarnings:unchecked
encodeback to summary
public static byte[] encode(String s, Charset charset)

Encodes a String into bytes of a given encoding.

This method is preferred to Charset#encode(String) and String#getBytes(String) (etc.) since those methods will replace or ignore bad input, and here we throw an exception.

Parameters
s:String

the string to encode.

Returns:byte[]

the encoded string, not null.

Exceptions
IonException:
if there's a CharacterCodingException.
getSidForSymbolTableFieldback to summary
public static final int getSidForSymbolTableField(String text)

Returns the symbol ID matching a system symbol text of a local or shared symtab field.

initialSymtabback to summary
public static SymbolTable initialSymtab(_Private_LocalSymbolTableFactory lstFactory, SymbolTable defaultSystemSymtab, SymbolTable... imports)

Returns a minimal symtab that, either system or local depending on the given values, that supports representation as an IonStruct. If the imports are empty, the default system symtab is returned.

Parameters
lstFactory:_Private_LocalSymbolTableFactory

the factory to use to build the local symbol table, never null

defaultSystemSymtab:SymbolTable

the default system symtab, which will be used if the first import in imports isn't a system symtab, never null

imports:SymbolTable[]

the set of shared symbol tables to import; may be null or empty. The first (and only the first) may be a system table, in which case the defaultSystemSymtab is ignored.

intIteratorback to summary
public static final Iterator<Integer> intIterator(int... values)
intIteratorback to summary
public static final Iterator<Integer> intIterator(int[] values, int len)
isNonSymbolScalarback to summary
public static boolean isNonSymbolScalar(IonType type)

Determines whether the passed-in data type is a scalar and not a symbol.

isTrivialTableback to summary
public static boolean isTrivialTable(SymbolTable table)

Is the table null, system, or local without imported symbols?

iterateback to summary
public static Iterator<IonValue> iterate(ValueFactory valueFactory, IonReader input)

Create a value iterator from a reader. Primarily a trampoline for access permission.

loadFileBytesback to summary
public static byte[] loadFileBytes(File file) throws IOException
loadReaderback to summary
public static String loadReader(Reader in) throws IOException
loadStreamBytesback to summary
public static byte[] loadStreamBytes(InputStream in) throws IOException
localizeback to summary
public static SymbolToken localize(SymbolTable symtab, SymbolToken sym)
localizeback to summary
public static void localize(SymbolTable symtab, SymbolToken[] syms, int count)
Parameters
syms:SymbolToken[]

may be mutated, replacing entries with localized updates!

localizeback to summary
public static void localize(SymbolTable symtab, SymbolToken[] syms)
Parameters
syms:SymbolToken[]

may be mutated, replacing entries with localized updates!

localSymtabExtendsback to summary
private static boolean localSymtabExtends(SymbolTable superset, SymbolTable subset)

Determines, for two local symbol tables, whether the passed-in superset symtab is an extension of subset. This works independent of implementation details--particularly in cases where LocalSymbolTable#symtabExtends(SymbolTable) cannot be used.

See Also
symtabExtends(SymbolTable, SymbolTable)
newLocalSymbolTableAsStructFactoryback to summary
public static _Private_LocalSymbolTableFactory newLocalSymbolTableAsStructFactory(ValueFactory imageFactory)

Deprecated

due to DOM entanglement. Streaming applications should use LocalSymbolTable#DEFAULT_LST_FACTORY.

Trampoline to LocalSymbolTableAsStruct.Factory#Factory(ValueFactory)

Parameters
imageFactory:ValueFactory

the ValueFactory from which to construct the IonStruct representation of the LST

Returns:_Private_LocalSymbolTableFactory

a new LocalSymbolTableAsStruct.Factory

Annotations
@Deprecated
newSharedSymtabback to summary
public static SymbolTable newSharedSymtab(IonStruct ionRep)
newSharedSymtabback to summary
public static SymbolTable newSharedSymtab(IonReader reader, boolean alreadyInStruct)
newSharedSymtabback to summary
public static SymbolTable newSharedSymtab(String name, int version, SymbolTable priorSymtab, Iterator<String> symbols)

As per IonSystem#newSharedSymbolTable(String, int, Iterator, SymbolTable...), any duplicate or null symbol texts are skipped. Therefore, THIS METHOD IS NOT SUITABLE WHEN READING SERIALIZED SHARED SYMBOL TABLES since that scenario must preserve all sids.

Parameters
priorSymtab:SymbolTable

may be null.

newSubstituteSymtabback to summary
public static SymbolTable newSubstituteSymtab(SymbolTable original, int version, int maxId)
newSymbolTokenback to summary
public static SymbolTokenImpl newSymbolToken(String text, int sid)
Returns:SymbolTokenImpl

not null

newSymbolTokenback to summary
public static SymbolTokenImpl newSymbolToken(int sid)
Returns:SymbolTokenImpl

not null

newSymbolTokenback to summary
public static SymbolToken newSymbolToken(SymbolTable symtab, String text)

Checks symbol content.

Returns:SymbolToken

not null

newSymbolTokenback to summary
public static SymbolToken newSymbolToken(SymbolTable symtab, int sid)
Returns:SymbolToken

not null

newSymbolTokensback to summary
public static SymbolToken[] newSymbolTokens(SymbolTable symtab, String... text)

Validates each text element.

Parameters
text:String[]

may be null or empty.

Returns:SymbolToken[]

not null.

newSymbolTokensback to summary
public static SymbolToken[] newSymbolTokens(SymbolTable symtab, int... syms)
Parameters
syms:int[]

may be null or empty.

Returns:SymbolToken[]

not null.

readFullyback to summary
public static int readFully(InputStream in, byte[] buf) throws IOException

Calls InputStream#read(byte[], int, int) until the buffer is filled or EOF is encountered. This method will block until the request is satisfied.

Parameters
in:InputStream

The stream to read from.

buf:byte[]

The buffer to read to.

Returns:int

the number of bytes read from the stream. May be less than buf.length if EOF is encountered before reading that far.

See Also
readFully(InputStream, byte[], int, int)
readFullyback to summary
public static int readFully(InputStream in, byte[] buf, int offset, int length) throws IOException

Calls InputStream#read(byte[], int, int) until the requested length is read or EOF is encountered. This method will block until the request is satisfied.

Parameters
in:InputStream

The stream to read from.

buf:byte[]

The buffer to read to.

offset:int

The offset of the buffer to read from.

length:int

The length of the data to read.

Returns:int

the number of bytes read from the stream. May be less than length if EOF is encountered before reading that far.

See Also
readFully(InputStream, byte[])
safeEqualsback to summary
public static boolean safeEquals(Object a, Object b)
streamIsIonBinaryback to summary
public static boolean streamIsIonBinary(PushbackInputStream pushback) throws IonException, IOException
stringIteratorback to summary
public static final Iterator<String> stringIterator(String... values)
stringIteratorback to summary
public static final Iterator<String> stringIterator(String[] values, int len)
symtabExtendsback to summary
public static boolean symtabExtends(SymbolTable superset, SymbolTable subset)

Determines whether the passed-in superset symtab is an extension of subset.

If both are LSTs, their imported tables and locally declared symbols are exhaustively checked, which can be expensive. Callers of this method should cache the results of these comparisons.

Parameters
superset:SymbolTable

either a system or local symbol table

subset:SymbolTable

either a system or local symbol table

Returns:boolean

true if superset extends subset, false if not

symtabIsLocalAndNonTrivialback to summary
public static boolean symtabIsLocalAndNonTrivial(SymbolTable symtab)
symtabIsSharedNotSystemback to summary
public static final boolean symtabIsSharedNotSystem(SymbolTable symtab)

Indicates whether a table is shared but not a system table.

symtabTreeback to summary
public static IonStruct symtabTree(SymbolTable symtab, ValueFactory valueFactory)
Annotations
@SuppressWarnings:deprecation
systemSymtabback to summary
public static SymbolTable systemSymtab(int version)
toSidsback to summary
public static int[] toSids(SymbolToken[] symbols, int count)
toStringsback to summary
public static String[] toStrings(SymbolToken[] symbols, int count)

Extracts the non-null text from a list of symbol tokens.

Returns:String[]

not null.

Exceptions
UnknownSymbolException:
if any token is missing text.
utf8back to summary
public static byte[] utf8(String s)

Encodes a String into UTF-8 bytes.

This method is preferred to Charset#encode(String) and String#getBytes(String) (etc.) since those methods will replace or ignore bad input, and here we throw an exception.

Parameters
s:String

the string to encode.

Returns:byte[]

the encoded UTF-8 bytes, not null.

Exceptions
IonException:
if there's a CharacterCodingException.
utf8back to summary
public static String utf8(byte[] bytes)

Decodes a UTF-8 byte sequence to a String.

This method is preferred to Charset#decode(ByteBuffer) and String#String(byte[], Charset) (etc.) since those methods will replace or ignore bad input, and here we throw an exception.

Parameters
bytes:byte[]

the data to decode.

Returns:String

the decoded string, not null.

Exceptions
IonException:
if there's a CharacterCodingException.
utf8FileToStringback to summary
public static String utf8FileToString(File file) throws IonException, IOException
valueIsLocalSymbolTableback to summary
public static boolean valueIsLocalSymbolTable(_Private_IonValue v)

Checks the passed in value and returns whether or not the value could be a local symbol table. It does this by checking the type and annotations.

Returns:boolean

boolean true if v can be a local symbol table otherwise false

writeAsBase64back to summary
public static void writeAsBase64(InputStream byteStream, Appendable out) throws IOException
com.amazon.ion.impl back to summary

private final Class _Private_Utils.IntIterator

extends Object
implements Iterator<Integer>
Class Inheritance
All Implemented Interfaces
java.util.Iterator

Private to route clients through the static methods, which can optimize the empty-list case.

Field Summary

Modifier and TypeField and Description
private final int
private int
private final int[]

Constructor Summary

AccessConstructor and Description
pack-priv
IntIterator(int[] values)

pack-priv
IntIterator(int[] values, int off, int len)

Method Summary

Modifier and TypeMethod and Description
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.

public Integer
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.

public void
remove()

Overrides default java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_lenback to summary
private final int _len
_posback to summary
private int _pos
_valuesback to summary
private final int[] _values

Constructor Detail

IntIteratorback to summary
pack-priv IntIterator(int[] values)
IntIteratorback to summary
pack-priv IntIterator(int[] values, int off, int len)

Method Detail

hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Returns:boolean

true if the iteration has more elements

nextback to summary
public Integer next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:Integer

the next element in the iteration

removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Doc from java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call to next.

The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.

The behavior of an iterator is unspecified if this method is called after a call to the forEachRemaining method.

com.amazon.ion.impl back to summary

private final Class _Private_Utils.StringIterator

extends Object
implements Iterator<String>
Class Inheritance
All Implemented Interfaces
java.util.Iterator

Private to route clients through the static methods, which can optimize the empty-list case.

Field Summary

Modifier and TypeField and Description
private final int
private int
private final String[]

Constructor Summary

AccessConstructor and Description
pack-priv
StringIterator(String[] values, int len)

Method Summary

Modifier and TypeMethod and Description
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.

public String
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.

public void
remove()

Overrides default java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_lenback to summary
private final int _len
_posback to summary
private int _pos
_valuesback to summary
private final String[] _values

Constructor Detail

StringIteratorback to summary
pack-priv StringIterator(String[] values, int len)

Method Detail

hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Returns:boolean

true if the iteration has more elements

nextback to summary
public String next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:String

the next element in the iteration

removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Doc from java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call to next.

The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.

The behavior of an iterator is unspecified if this method is called after a call to the forEachRemaining method.