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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanbooleanaddAll(int index, Collection<? extends BsonValue> c) booleanaddAll(Collection<? extends BsonValue> c) voidclear()clone()booleanbooleancontainsAll(Collection<?> c) booleanget(int index) Gets the BSON type of this value.Gets the values in this array as a list ofBsonValueobjects.inthashCode()intbooleanisEmpty()iterator()intlistIterator(int index) static BsonArrayParses a string in MongoDB Extended JSON format to aBsonArrayremove(int index) booleanbooleanremoveAll(Collection<?> c) booleanretainAll(Collection<?> c) intsize()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, isTimestampMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods 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
BsonArrayobject - Since:
- 3.4
- See Also:
- MongoDB documentation
- MongoDB Extended JSON
-
getValues
Gets the values in this array as a list ofBsonValueobjects.- Returns:
- the values in this array.
-
getBsonType
Description copied from class:BsonValueGets the BSON type of this value.- Specified by:
getBsonTypein 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:
containsAllin interfaceCollection<BsonValue>- Specified by:
containsAllin interfaceList<BsonValue>
-
addAll
-
addAll
-
removeAll
-
retainAll
-
clear
public void clear() -
get
-
set
-
add
-
remove
-
indexOf
-
lastIndexOf
- Specified by:
lastIndexOfin interfaceList<BsonValue>
-
listIterator
- Specified by:
listIteratorin interfaceList<BsonValue>
-
listIterator
- Specified by:
listIteratorin interfaceList<BsonValue>
-
subList
-
equals
-
hashCode
public int hashCode() -
toString
-
clone
-