1 17 package org.apache.commons.collections.primitives; 18 19 import org.apache.commons.collections.primitives.decorators.UnmodifiableDoubleIterator; 20 import org.apache.commons.collections.primitives.decorators.UnmodifiableDoubleList; 21 import org.apache.commons.collections.primitives.decorators.UnmodifiableDoubleListIterator; 22 23 34 public final class DoubleCollections { 35 36 41 public static DoubleList singletonDoubleList(double value) { 42 DoubleList list = new ArrayDoubleList(1); 44 list.add(value); 45 return UnmodifiableDoubleList.wrap(list); 46 } 47 48 53 public static DoubleIterator singletonDoubleIterator(double value) { 54 return singletonDoubleList(value).iterator(); 55 } 56 57 62 public static DoubleListIterator singletonDoubleListIterator(double value) { 63 return singletonDoubleList(value).listIterator(); 64 } 65 66 73 public static DoubleList unmodifiableDoubleList(DoubleList list) throws NullPointerException { 74 if(null == list) { 75 throw new NullPointerException (); 76 } 77 return UnmodifiableDoubleList.wrap(list); 78 } 79 80 87 public static DoubleIterator unmodifiableDoubleIterator(DoubleIterator iter) { 88 if(null == iter) { 89 throw new NullPointerException (); 90 } 91 return UnmodifiableDoubleIterator.wrap(iter); 92 } 93 94 101 public static DoubleListIterator unmodifiableDoubleListIterator(DoubleListIterator iter) { 102 if(null == iter) { 103 throw new NullPointerException (); 104 } 105 return UnmodifiableDoubleListIterator.wrap(iter); 106 } 107 108 113 public static DoubleList getEmptyDoubleList() { 114 return EMPTY_DOUBLE_LIST; 115 } 116 117 122 public static DoubleIterator getEmptyDoubleIterator() { 123 return EMPTY_DOUBLE_ITERATOR; 124 } 125 126 131 public static DoubleListIterator getEmptyDoubleListIterator() { 132 return EMPTY_DOUBLE_LIST_ITERATOR; 133 } 134 135 139 public static final DoubleList EMPTY_DOUBLE_LIST = unmodifiableDoubleList(new ArrayDoubleList(0)); 140 141 145 public static final DoubleIterator EMPTY_DOUBLE_ITERATOR = unmodifiableDoubleIterator(EMPTY_DOUBLE_LIST.iterator()); 146 147 151 public static final DoubleListIterator EMPTY_DOUBLE_LIST_ITERATOR = unmodifiableDoubleListIterator(EMPTY_DOUBLE_LIST.listIterator()); 152 } 153 | Popular Tags |