Package io.karma.sliced.slice.impl
Class EmptyBoolSlice
java.lang.Object
io.karma.sliced.slice.impl.EmptyBoolSlice
- All Implemented Interfaces:
BoolSlice
,Slice<Boolean>
,Resettable
,ResettableEnumeration<Boolean>
,BoolView
,View<Boolean>
,Iterable<Boolean>
,Enumeration<Boolean>
- Since:
- 25/02/2024
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescription@NotNull BoolIterator
Creates a newBoolIterator
from the elements referenced by this slice instance.boolean
getBool
(int index) Retrieves aboolean
value from this slice instance at the given index.boolean
int
offset()
Retrieves the start index of this slice instance.void
reset()
Resets the internal states of this object instance.int
size()
Retrieves the number of elements contained within the array/collection referenced by this array.slice
(int offset, int size) Creates a new sub-slice from this slice instance, with the given index range relative to the start index of this slice instance.boolean[]
toBoolArray
(int offset, int size) Creates a newboolean
array with the appropriate size, and copies all values fromstart
toend
into new newly created array usingSystem.arraycopy(Object, int, Object, int, int)
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.karma.sliced.slice.BoolSlice
asSlice, get, map, toBoolArray
Methods inherited from interface java.util.Enumeration
asIterator
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface io.karma.sliced.slice.Slice
copy, copy, copy, copyArrayList, copyHashSet, forEachIndexed, getOptional, getOrElse, getOrThrow, map, toArray, toArray
Methods inherited from interface io.karma.sliced.view.View
contains, containsAll, containsAllRefs, containsRef, contentEquals, contentEquals, copyArrayList, copyHashSet, forAll, forAllIndexed, parallelStream, referencesEqual, referencesEqual, stream
-
Field Details
-
INSTANCE
-
-
Method Details
-
getBool
public boolean getBool(int index) Description copied from interface:BoolSlice
Retrieves aboolean
value from this slice instance at the given index. -
toBoolArray
public boolean[] toBoolArray(int offset, int size) Description copied from interface:BoolSlice
Creates a newboolean
array with the appropriate size, and copies all values fromstart
toend
into new newly created array usingSystem.arraycopy(Object, int, Object, int, int)
.- Specified by:
toBoolArray
in interfaceBoolSlice
- Parameters:
offset
- The index at which the newly created array should begin (relative to the offset of this slice).size
- The size of the newly created array.- Returns:
- A new array containing all elements from
start
toend
.
-
offset
public int offset()Description copied from interface:Slice
Retrieves the start index of this slice instance. -
slice
Description copied from interface:Slice
Creates a new sub-slice from this slice instance, with the given index range relative to the start index of this slice instance.- Specified by:
slice
in interfaceSlice<Boolean>
- Parameters:
offset
- The index at which the newly created slice should begin (relative to the offset of this slice).size
- The size of the newly created slice.- Returns:
- A new slice instance containing the same collection/array reference as this slice instance, but with the given relative index range.
-
reset
public void reset()Description copied from interface:Resettable
Resets the internal states of this object instance.- Specified by:
reset
in interfaceResettable
-
boolIterator
Description copied from interface:BoolView
Creates a newBoolIterator
from the elements referenced by this slice instance.- Specified by:
boolIterator
in interfaceBoolView
- Returns:
- A new
BoolIterator
from the elements referenced by this slice instance.
-
size
public int size()Description copied from interface:View
Retrieves the number of elements contained within the array/collection referenced by this array. -
hasMoreElements
public boolean hasMoreElements()- Specified by:
hasMoreElements
in interfaceEnumeration<Boolean>
-
nextElement
- Specified by:
nextElement
in interfaceEnumeration<Boolean>
-