comparison graal/com.oracle.max.base/src/com/sun/max/collect/PoolSet.java @ 4142:bc8527f3071c

Adjust code base to new level of warnings.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Sun, 18 Dec 2011 05:24:06 +0100
parents e233f5660da4
children
comparison
equal deleted inserted replaced
4141:04d21be7a24f 4142:bc8527f3071c
147 * @param pool the pool of objects that the returned set provides a view upon 147 * @param pool the pool of objects that the returned set provides a view upon
148 * @return an empty pool set that can be subsequently modified to contain objects from {@code pool} 148 * @return an empty pool set that can be subsequently modified to contain objects from {@code pool}
149 */ 149 */
150 public static <T extends PoolObject> PoolSet<T> noneOf(Pool<T> pool) { 150 public static <T extends PoolObject> PoolSet<T> noneOf(Pool<T> pool) {
151 if (pool.length() <= PoolSet64.MAX_POOL_SIZE) { 151 if (pool.length() <= PoolSet64.MAX_POOL_SIZE) {
152 return new PoolSet64<T>(pool); 152 return new PoolSet64<>(pool);
153 } 153 }
154 if (pool.length() <= PoolSet128.MAX_POOL_SIZE) { 154 if (pool.length() <= PoolSet128.MAX_POOL_SIZE) {
155 return new PoolSet128<T>(pool); 155 return new PoolSet128<>(pool);
156 } 156 }
157 return new PoolBitSet<T>(pool); 157 return new PoolBitSet<>(pool);
158 } 158 }
159 159
160 /** 160 /**
161 * Creates a pool set initially containing all the objects in a given pool. 161 * Creates a pool set initially containing all the objects in a given pool.
162 * 162 *
176 * @param pool the pool of objects that the returned set provides a view upon 176 * @param pool the pool of objects that the returned set provides a view upon
177 * @param first an object that will be in the returned set 177 * @param first an object that will be in the returned set
178 * @param rest zero or more objects that will be in the returned set 178 * @param rest zero or more objects that will be in the returned set
179 * @return a pool set containing {@code first} and all the objects in {@code rest} 179 * @return a pool set containing {@code first} and all the objects in {@code rest}
180 */ 180 */
181 @SafeVarargs
181 public static <T extends PoolObject, S extends T> PoolSet<T> of(Pool<T> pool, S first, S... rest) { 182 public static <T extends PoolObject, S extends T> PoolSet<T> of(Pool<T> pool, S first, S... rest) {
182 final PoolSet<T> poolSet = noneOf(pool); 183 final PoolSet<T> poolSet = noneOf(pool);
183 poolSet.add(first); 184 poolSet.add(first);
184 for (T object : rest) { 185 for (T object : rest) {
185 poolSet.add(object); 186 poolSet.add(object);