public TreeMap(SortedMap map) { this.comparator = map.comparator(); this.buildFromSorted(map.entrySet().iterator(), map.size()); }
public TreeMap(SortedMap map) { this.comparator = map.comparator(); this.buildFromSorted(map.entrySet().iterator(), map.size()); }
public TreeMap(SortedMap map) { this.comparator = map.comparator(); this.buildFromSorted(map.entrySet().iterator(), map.size()); }
public void putAll(Map map) { if (map instanceof SortedMap) { SortedMap smap = (SortedMap)map; if (eq(this.comparator, smap.comparator())) { this.buildFromSorted(smap.entrySet().iterator(), map.size()); return; } } // not a sorted map, or comparator mismatch super.putAll(map); }
public void putAll(Map map) { if (map instanceof SortedMap) { SortedMap smap = (SortedMap)map; if (eq(this.comparator, smap.comparator())) { this.buildFromSorted(smap.entrySet().iterator(), map.size()); return; } } // not a sorted map, or comparator mismatch super.putAll(map); }
public void putAll(Map map) { if (map instanceof SortedMap) { SortedMap smap = (SortedMap)map; if (eq(this.comparator, smap.comparator())) { this.buildFromSorted(smap.entrySet().iterator(), map.size()); return; } } // not a sorted map, or comparator mismatch super.putAll(map); }
public Object clone() { TreeMap clone; try { clone = (TreeMap)super.clone(); } catch (CloneNotSupportedException e) { throw new InternalError(); } clone.root = null; clone.size = 0; clone.modCount = 0; if (!isEmpty()) { clone.buildFromSorted(this.entrySet().iterator(), this.size); } return clone; }
public Object clone() { TreeMap clone; try { clone = (TreeMap)super.clone(); } catch (CloneNotSupportedException e) { throw new InternalError(); } clone.root = null; clone.size = 0; clone.modCount = 0; if (!isEmpty()) { clone.buildFromSorted(this.entrySet().iterator(), this.size); } return clone; }
public Object clone() { TreeMap clone; try { clone = (TreeMap)super.clone(); } catch (CloneNotSupportedException e) { throw new InternalError(); } clone.root = null; clone.size = 0; clone.modCount = 0; if (!isEmpty()) { clone.buildFromSorted(this.entrySet().iterator(), this.size); } return clone; }
public boolean addAll(Collection c) { if (map.size() == 0 && c.size() > 0 && c instanceof SortedSet && map instanceof TreeMap && eq(((SortedSet)c).comparator(), this.comparator())) { ((TreeMap)map).buildFromSorted(new MapIterator(c.iterator()), c.size()); return true; } else { return super.addAll(c); } }
private void readObject(ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { in.defaultReadObject(); int size = in.readInt(); try { buildFromSorted(new IOIterator(in, size), size); } catch (IteratorIOException e) { throw e.getException(); } catch (IteratorNoClassException e) { throw e.getException(); } }
public boolean addAll(Collection c) { if (map.size() == 0 && c.size() > 0 && c instanceof SortedSet && map instanceof TreeMap && eq(((SortedSet)c).comparator(), this.comparator())) { ((TreeMap)map).buildFromSorted(new MapIterator(c.iterator()), c.size()); return true; } else { return super.addAll(c); } }
public boolean addAll(Collection c) { if (map.size() == 0 && c.size() > 0 && c instanceof SortedSet && map instanceof TreeMap && eq(((SortedSet)c).comparator(), this.comparator())) { ((TreeMap)map).buildFromSorted(new MapIterator(c.iterator()), c.size()); return true; } else { return super.addAll(c); } }
private void readObject(ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { in.defaultReadObject(); int size = in.readInt(); try { buildFromSorted(new IOIterator(in, size), size); } catch (IteratorIOException e) { throw e.getException(); } catch (IteratorNoClassException e) { throw e.getException(); } }
private void readObject(ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { in.defaultReadObject(); int size = in.readInt(); try { buildFromSorted(new IOIterator(in, size), size); } catch (IteratorIOException e) { throw e.getException(); } catch (IteratorNoClassException e) { throw e.getException(); } }
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); Comparator comparator = (Comparator)in.readObject(); TreeMap map = new TreeMap(comparator); int size = in.readInt(); try { map.buildFromSorted(new IOIterator(in, size), size); this.map = map; } catch (TreeMap.IteratorIOException e) { throw e.getException(); } catch (TreeMap.IteratorNoClassException e) { throw e.getException(); } } }
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); Comparator comparator = (Comparator)in.readObject(); TreeMap map = new TreeMap(comparator); int size = in.readInt(); try { map.buildFromSorted(new IOIterator(in, size), size); this.map = map; } catch (TreeMap.IteratorIOException e) { throw e.getException(); } catch (TreeMap.IteratorNoClassException e) { throw e.getException(); } } }
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); Comparator comparator = (Comparator)in.readObject(); TreeMap map = new TreeMap(comparator); int size = in.readInt(); try { map.buildFromSorted(new IOIterator(in, size), size); this.map = map; } catch (TreeMap.IteratorIOException e) { throw e.getException(); } catch (TreeMap.IteratorNoClassException e) { throw e.getException(); } } }