Package com.lucimber.dbus.type
Class DBusArray<ElementT extends DBusType>
java.lang.Object
com.lucimber.dbus.type.DBusArray<ElementT>
- Type Parameters:
ElementT- The element's data type.
- All Implemented Interfaces:
DBusContainerType,DBusType,Iterable<ElementT>,Collection<ElementT>,List<ElementT>
public final class DBusArray<ElementT extends DBusType>
extends Object
implements List<ElementT>, DBusContainerType
An ordered collection of elements.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new instance from another one.DBusArray(DBusSignature signature) Constructs a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanbooleanaddAll(int index, Collection<? extends ElementT> c) booleanaddAll(Collection<? extends ElementT> c) voidclear()booleanbooleancontainsAll(Collection<?> c) Creates an empty array with the specified element signature.booleanvoidget(int index) Gets the wrapped value of this container type.Gets the signature of this container type.getType()Gets the type of this implementation.inthashCode()intbooleanisEmpty()iterator()intlistIterator(int index) static DBusArray<DBusBoolean>ofBooleans(boolean... booleans) Creates an array of booleans.static DBusArray<DBusDouble>ofDoubles(double... doubles) Creates an array of doubles.ofInt32s(int... integers) Creates an array of 32-bit integers.ofInt64s(long... longs) Creates an array of 64-bit integers.static DBusArray<DBusObjectPath>ofObjectPaths(String... paths) Creates an array of object paths.static DBusArray<DBusString>Creates an array of strings.remove(int index) booleanbooleanremoveAll(Collection<?> c) booleanvoidreplaceAll(UnaryOperator<ElementT> operator) booleanretainAll(Collection<?> c) intsize()voidsort(Comparator<? super ElementT> c) stream()subList(int fromIndex, int toIndex) Object[]toArray()<T> T[]toArray(T[] a) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Collection
toArray
-
Constructor Details
-
DBusArray
Constructs a new instance.- Parameters:
signature- aDBusSignature; must describe an array
-
DBusArray
Constructs a new instance from another one.- Parameters:
other- aDBusArray
-
-
Method Details
-
ofStrings
Creates an array of strings.- Parameters:
strings- the strings to add to the array- Returns:
- a new DBusArray containing DBusString elements
-
ofInt32s
Creates an array of 32-bit integers.- Parameters:
integers- the integers to add to the array- Returns:
- a new DBusArray containing DBusInt32 elements
-
ofInt64s
Creates an array of 64-bit integers.- Parameters:
longs- the longs to add to the array- Returns:
- a new DBusArray containing DBusInt64 elements
-
ofBooleans
Creates an array of booleans.- Parameters:
booleans- the booleans to add to the array- Returns:
- a new DBusArray containing DBusBoolean elements
-
ofDoubles
Creates an array of doubles.- Parameters:
doubles- the doubles to add to the array- Returns:
- a new DBusArray containing DBusDouble elements
-
ofObjectPaths
Creates an array of object paths.- Parameters:
paths- the paths to add to the array- Returns:
- a new DBusArray containing DBusObjectPath elements
-
empty
Creates an empty array with the specified element signature.- Type Parameters:
T- the element type- Parameters:
elementSignature- the signature of the array elements (e.g., "s" for strings)- Returns:
- a new empty DBusArray
-
size
public int size() -
isEmpty
public boolean isEmpty() -
contains
-
iterator
-
toArray
-
toArray
public <T> T[] toArray(T[] a) -
add
-
add
-
remove
-
remove
-
containsAll
- Specified by:
containsAllin interfaceCollection<ElementT extends DBusType>- Specified by:
containsAllin interfaceList<ElementT extends DBusType>
-
addAll
-
addAll
-
removeAll
-
retainAll
-
clear
public void clear() -
get
-
set
-
indexOf
-
lastIndexOf
- Specified by:
lastIndexOfin interfaceList<ElementT extends DBusType>
-
listIterator
- Specified by:
listIteratorin interfaceList<ElementT extends DBusType>
-
listIterator
- Specified by:
listIteratorin interfaceList<ElementT extends DBusType>
-
subList
-
getSignature
Description copied from interface:DBusContainerTypeGets the signature of this container type. The returned signature describes the container and its content.- Specified by:
getSignaturein interfaceDBusContainerType- Returns:
- a
DBusSignature
-
getType
Description copied from interface:DBusTypeGets the type of this implementation. -
getDelegate
Description copied from interface:DBusContainerTypeGets the wrapped value of this container type. The D-Bus type system is made of ASCII characters representing the value's type. Each D-Bus data type is mapped in this framework by its corresponding class. This method enables the access to the Java's data type - the delegate. If this container is for example aDBusArray, the returned object will be aList.- Specified by:
getDelegatein interfaceDBusContainerType- Returns:
- an
Object
-
forEach
-
replaceAll
- Specified by:
replaceAllin interfaceList<ElementT extends DBusType>
-
sort
-
spliterator
- Specified by:
spliteratorin interfaceCollection<ElementT extends DBusType>- Specified by:
spliteratorin interfaceIterable<ElementT extends DBusType>- Specified by:
spliteratorin interfaceList<ElementT extends DBusType>
-
removeIf
- Specified by:
removeIfin interfaceCollection<ElementT extends DBusType>
-
stream
- Specified by:
streamin interfaceCollection<ElementT extends DBusType>
-
parallelStream
- Specified by:
parallelStreamin interfaceCollection<ElementT extends DBusType>
-
equals
-
hashCode
public int hashCode()
-