/** {@inheritDoc} */
 @Override
 public boolean addAll(Collection<? extends Short> collection) {
   boolean changed = false;
   for (Short element : collection) {
     short e = element.shortValue();
     if (add(e)) {
       changed = true;
     }
   }
   return changed;
 }
 /** {@inheritDoc} */
 @SuppressWarnings({"SuspiciousMethodCalls"})
 public boolean retainAll(Collection<?> collection) {
   boolean modified = false;
   TShortIterator iter = iterator();
   while (iter.hasNext()) {
     if (!collection.contains(Short.valueOf(iter.next()))) {
       iter.remove();
       modified = true;
     }
   }
   return modified;
 }
Example #3
0
 @SuppressWarnings("UnnecessaryBoxing")
 private static Object box(final Object value) {
   Object newBoxedValue;
   if (value instanceof Integer) {
     newBoxedValue = Integer.valueOf(((Integer) value).intValue());
   } else if (value instanceof Byte) {
     newBoxedValue = Byte.valueOf(((Byte) value).byteValue());
   } else if (value instanceof Short) {
     newBoxedValue = Short.valueOf(((Short) value).shortValue());
   } else if (value instanceof Long) {
     newBoxedValue = Long.valueOf(((Long) value).longValue());
   } else if (value instanceof Boolean) {
     newBoxedValue = Boolean.valueOf(((Boolean) value).booleanValue());
   } else if (value instanceof Character) {
     newBoxedValue = Character.valueOf(((Character) value).charValue());
   } else {
     return new Object();
   }
   return newBoxedValue;
 }