Package org.bson
Class BsonArray
java.lang.Object
org.bson.BsonValue
org.bson.BsonArray
- Direct Known Subclasses:
RawBsonArray
A type-safe representation of the BSON array type.
- Since:
- 3.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
boolean
boolean
addAll
(int index, Collection<? extends BsonValue> c) boolean
addAll
(Collection<? extends BsonValue> c) void
clear()
clone()
boolean
boolean
containsAll
(Collection<?> c) boolean
get
(int index) Gets the BSON type of this value.Gets the values in this array as a list ofBsonValue
objects.int
hashCode()
int
boolean
isEmpty()
iterator()
int
listIterator
(int index) static BsonArray
Parses a string in MongoDB Extended JSON format to aBsonArray
remove
(int index) boolean
boolean
removeAll
(Collection<?> c) boolean
retainAll
(Collection<?> c) int
size()
subList
(int fromIndex, int toIndex) Object[]
toArray()
<T> T[]
toArray
(T[] a) toString()
Methods inherited from class org.bson.BsonValue
asArray, asBinary, asBoolean, asDateTime, asDBPointer, asDecimal128, asDocument, asDouble, asInt32, asInt64, asJavaScript, asJavaScriptWithScope, asNumber, asObjectId, asRegularExpression, asString, asSymbol, asTimestamp, isArray, isBinary, isBoolean, isDateTime, isDBPointer, isDecimal128, isDocument, isDouble, isInt32, isInt64, isJavaScript, isJavaScriptWithScope, isNull, isNumber, isObjectId, isRegularExpression, isString, isSymbol, isTimestamp
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.List
replaceAll, sort, spliterator
-
Constructor Details
-
BsonArray
Construct an instance with the given list of values.- Parameters:
values
- the list of values, none of whose members may be null.
-
BsonArray
public BsonArray()Construct an empty BsonArray -
BsonArray
public BsonArray(int initialCapacity) Construct an empty BsonArray with the specified initial capacity.- Parameters:
initialCapacity
- the initial capacity of the BsonArray- Throws:
IllegalArgumentException
- if the specified initial capacity is negative- Since:
- 4.3
-
-
Method Details
-
parse
Parses a string in MongoDB Extended JSON format to aBsonArray
- Parameters:
json
- the JSON string- Returns:
- a corresponding
BsonArray
object - Since:
- 3.4
- See Also:
- MongoDB documentation
- MongoDB Extended JSON
-
getValues
Gets the values in this array as a list ofBsonValue
objects.- Returns:
- the values in this array.
-
getBsonType
Description copied from class:BsonValue
Gets the BSON type of this value.- Specified by:
getBsonType
in classBsonValue
- Returns:
- the BSON type, which may not be null (but may be BSONType.NULL)
-
size
public int size() -
isEmpty
public boolean isEmpty() -
contains
-
iterator
-
toArray
-
toArray
public <T> T[] toArray(T[] a) -
add
-
remove
-
containsAll
- Specified by:
containsAll
in interfaceCollection<BsonValue>
- Specified by:
containsAll
in interfaceList<BsonValue>
-
addAll
-
addAll
-
removeAll
-
retainAll
-
clear
public void clear() -
get
-
set
-
add
-
remove
-
indexOf
-
lastIndexOf
- Specified by:
lastIndexOf
in interfaceList<BsonValue>
-
listIterator
- Specified by:
listIterator
in interfaceList<BsonValue>
-
listIterator
- Specified by:
listIterator
in interfaceList<BsonValue>
-
subList
-
equals
-
hashCode
public int hashCode() -
toString
-
clone
-