Fixes bug 590305.
* Constructs a read-only collection that mirrors the content of the
* specified collection.
*
- * @param collection the collection to decorate (may be null).
+ * @param collection the collection to decorate.
*/
- public ReadOnlyCollection (Collection<G>? collection = null) {
+ public ReadOnlyCollection (Collection<G> collection) {
this._collection = collection;
}
* @inheritDoc
*/
public Gee.Iterator<G> iterator () {
- if (_collection == null) {
- return new Iterator<G> ();
- }
-
return _collection.iterator ();
}
* @inheritDoc
*/
public bool contains (G item) {
- if (_collection == null) {
- return false;
- }
-
return _collection.contains (item);
}
* @inheritDoc
*/
public bool contains_all (Collection<G> collection) {
- foreach (G element in collection) {
- if (!contains (element)) {
- return false;
- }
- }
- return true;
+ return _collection.contains_all (collection);
}
/**
* Constructs a read-only list that mirrors the content of the specified
* list.
*
- * @param list the list to decorate (may be null).
+ * @param list the list to decorate.
*/
- public ReadOnlyList (List<G>? list = null) {
+ public ReadOnlyList (List<G> list) {
base (list);
}
* @inheritDoc
*/
public int index_of (G item) {
- if (_collection == null) {
- return -1;
- }
-
return ((Gee.List<G>) _collection).index_of (item);
}
* @inheritDoc
*/
public new G? get (int index) {
- if (_collection == null) {
- return null;
- }
-
return ((Gee.List<G>) _collection).get (index);
}
* @inheritDoc
*/
public G? first () {
- if (_collection == null) {
- return null;
- }
-
return ((Gee.List<G>) _collection).first ();
}
* @inheritDoc
*/
public G? last () {
- if (_collection == null) {
- return null;
- }
-
return ((Gee.List<G>) _collection).last ();
}
/**
* Constructs a read-only map that mirrors the content of the specified map.
*
- * @param map the map to decorate (may be null).
+ * @param map the map to decorate.
*/
- public ReadOnlyMap (Map<K,V>? map = null) {
+ public ReadOnlyMap (Map<K,V> map) {
this._map = map;
}
* @inheritDoc
*/
public Set<K> get_keys () {
- if (_map == null) {
- return new ReadOnlySet<K> ();
- }
-
return _map.get_keys ();
}
* @inheritDoc
*/
public Collection<V> get_values () {
- if (_map == null) {
- return new ReadOnlyCollection<V> ();
- }
-
return _map.get_values ();
}
* @inheritDoc
*/
public bool contains (K key) {
- if (_map == null) {
- return false;
- }
-
return _map.contains (key);
}
* @inheritDoc
*/
public new V? get (K key) {
- if (_map == null) {
- return null;
- }
-
return _map.get (key);
}
* @inheritDoc
*/
public bool contains_all (Map<K,V> map) {
- if (_map == null) {
- return false;
- }
-
return _map.contains_all (map);
}
}
*
* @param set the set to decorate.
*/
- public ReadOnlySet (Set<G>? set = null) {
+ public ReadOnlySet (Set<G> set) {
base(set);
}
}