/** * @param <V> * @param key * @param value * @return empty().plus(key, value) */ public static <V> IntTreePMap<V> singleton(final Integer key, final V value) { return IntTreePMap.<V>empty().plus(key, value); }
/** * @param <V> * @param key * @param value * @return empty().plus(key, value) */ public static <V> IntTreePMap<V> singleton(final Integer key, final V value) { return IntTreePMap.<V>empty().plus(key, value); }
public TreePVector<E> plusAll(int i, final Collection<? extends E> list) { if(i<0 || i>size()) throw new IndexOutOfBoundsException(); if(list.size()==0) return this; IntTreePMap<E> map = this.map.withKeysChangedAbove(i, list.size()); for(E e : list) map = map.plus(i++, e); return new TreePVector<E>( map ); }
public TreePVector<E> plusAll(int i, final Collection<? extends E> list) { if(i<0 || i>size()) throw new IndexOutOfBoundsException(); if(list.size()==0) return this; IntTreePMap<E> map = this.map.withKeysChangedAbove(i, list.size()); for(E e : list) map = map.plus(i++, e); return new TreePVector<E>( map ); }
public PVector<E> with(final int i, final E e) { if(i<0 || i>=size()) throw new IndexOutOfBoundsException(); IntTreePMap<E> map = this.map.plus(i, e); if(map==this.map) return this; return new TreePVector<E>( map ); } }
public PVector<E> with(final int i, final E e) { if(i<0 || i>=size()) throw new IndexOutOfBoundsException(); IntTreePMap<E> map = this.map.plus(i, e); if(map==this.map) return this; return new TreePVector<E>( map ); } }
public TreePVector<E> plus(final int i, final E e) { if(i<0 || i>size()) throw new IndexOutOfBoundsException(); return new TreePVector<E>( map.withKeysChangedAbove(i,1).plus(i,e) ); }
public TreePVector<E> plus(final int i, final E e) { if(i<0 || i>size()) throw new IndexOutOfBoundsException(); return new TreePVector<E>( map.withKeysChangedAbove(i,1).plus(i,e) ); }
public TreePVector<E> plus(final E e) { return new TreePVector<E>( map.plus(size(), e) ); }
public TreePVector<E> plus(final E e) { return new TreePVector<E>( map.plus(size(), e) ); }
public void testSingleton() { UtilityTest.assertEqualsAndHash(IntTreePMap.empty().plus(10, "test"), IntTreePMap.singleton(10, "test")); }
/** * @param <V> * @param key * @param value * @return empty().plus(key, value) */ public static <V> IntTreePMap<V> singleton(final Integer key, final V value) { return IntTreePMap.<V>empty().plus(key, value); }
/** * @param <V> * @param key * @param value * @return empty().plus(key, value) */ public static <V> IntTreePMap<V> singleton(final Integer key, final V value) { return IntTreePMap.<V>empty().plus(key, value); }
public TreePVector<E> plusAll(int i, final Collection<? extends E> list) { if (i < 0 || i > size()) throw new IndexOutOfBoundsException(); if (list.size() == 0) return this; IntTreePMap<E> map = this.map.withKeysChangedAbove(i, list.size()); for (E e : list) map = map.plus(i++, e); return new TreePVector<E>(map); }
public TreePVector<E> plusAll(int i, final Collection<? extends E> list) { if(i<0 || i>size()) throw new IndexOutOfBoundsException(); if(list.size()==0) return this; IntTreePMap<E> map = this.map.withKeysChangedAbove(i, list.size()); for(E e : list) map = map.plus(i++, e); return new TreePVector<E>( map ); }
public PVector<E> with(final int i, final E e) { if(i<0 || i>=size()) throw new IndexOutOfBoundsException(); IntTreePMap<E> map = this.map.plus(i, e); if(map==this.map) return this; return new TreePVector<E>( map ); } }
public PVector<E> with(final int i, final E e) { if (i < 0 || i >= size()) throw new IndexOutOfBoundsException(); IntTreePMap<E> map = this.map.plus(i, e); if (map == this.map) return this; return new TreePVector<E>(map); } }
public TreePVector<E> plus(final E e) { return new TreePVector<E>( map.plus(size(), e) ); }
public TreePVector<E> plus(final int i, final E e) { if (i < 0 || i > size()) throw new IndexOutOfBoundsException(); return new TreePVector<E>(map.withKeysChangedAbove(i, 1).plus(i, e)); }
public TreePVector<E> plus(final int i, final E e) { if(i<0 || i>size()) throw new IndexOutOfBoundsException(); return new TreePVector<E>( map.withKeysChangedAbove(i,1).plus(i,e) ); }