*/
package org.opendaylight.yangtools.util;
+import com.google.common.base.Preconditions;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
-
+import javax.annotation.Nonnull;
+import org.opendaylight.yangtools.triemap.MutableTrieMap;
+import org.opendaylight.yangtools.triemap.TrieMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.base.Preconditions;
-import com.romix.scala.collection.concurrent.TrieMap;
-
/**
* A TrieMap facade tracking modifications. Since we change structures based on
* their size, and determining the size of a TrieMap is expensive, we make sure
* to update it as we go.
*
- * FIXME: this map does not support modification view the keySet()/values()/entrySet()
+ * <p>FIXME: this map does not support modification view the keySet()/values()/entrySet()
* methods.
*
* @param <K> Key type
*/
final class ReadWriteTrieMap<K, V> implements Map<K, V> {
private static final Logger LOG = LoggerFactory.getLogger(ReadOnlyTrieMap.class);
- private final TrieMap<K, V> delegate;
+ private final MutableTrieMap<K, V> delegate;
private int size;
- ReadWriteTrieMap(final TrieMap<K, V> delegate, final int size) {
+ ReadWriteTrieMap() {
+ this.delegate = TrieMap.create();
+ this.size = 0;
+ }
+
+ ReadWriteTrieMap(final MutableTrieMap<K, V> delegate, final int size) {
this.delegate = Preconditions.checkNotNull(delegate);
this.size = size;
}
}
@Override
- public void putAll(final Map<? extends K, ? extends V> m) {
+ public void putAll(@Nonnull final Map<? extends K, ? extends V> m) {
for (Entry<? extends K, ? extends V> e : m.entrySet()) {
put(e.getKey(), e.getValue());
}
public int hashCode() {
return delegate.hashCode();
}
+
+ @Override
+ public String toString() {
+ return delegate.toString();
+ }
}