Creates a new collection with abstract types which can not be instantiated.
434529
private Collection<Class<? extends Saga>> removeAbstractTypes(final Collection<Class<? extends Saga>> foundTypes) {
        Collection<Class<? extends Saga>> sagaTypes = new ArrayList<>();

        for (Class<? extends Saga> entryType : foundTypes) {
            if (!Modifier.isAbstract(entryType.getModifiers())) {
                sagaTypes.add(entryType);
            }
        }

        return sagaTypes;
    }
1371229
static ImmutableSet<ExecutableElement> propertyMethodsIn(Set<ExecutableElement> abstractMethods) {
    ImmutableSet.Builder<ExecutableElement> properties = ImmutableSet.builder();
    for (ExecutableElement method : abstractMethods) {
      if (method.getParameters().isEmpty()
          && method.getReturnType().getKind() != TypeKind.VOID
          && objectMethodToOverride(method) == ObjectMethod.NONE) {
        properties.add(method);
      }
    }
    return properties.build();
  }
1285779
public static <E, T extends Collection<E>> T unmarshallCollectionUnbounded(ObjectInput in, UnboundedCollectionBuilder<E, T> builder) throws IOException, ClassNotFoundException {
      final int size = unmarshallSize(in);
      if (size == NULL_VALUE) {
         return null;
      }
      T collection = Objects.requireNonNull(builder, "UnboundedCollectionBuilder must be non-null").build();
      for (int i = 0; i < size; ++i) {
         //noinspection unchecked
         collection.add((E) in.readObject());
      }
      return collection;
   }
973914
public static <T, C extends Collection<T>> Map<T, C> makeElementsToContainersMap(
      final Iterable<C> collections) {
    final ImmutableMap.Builder<T, C> ret = ImmutableMap.builder();

    for (final C collection : collections) {
      for (final T item : collection) {
        ret.put(item, collection);
      }
    }

    return ret.build();
  }
434362
public static <T> RuntimeSchema<T> createFrom(Class<T> typeClass,
            Map<String, String> declaredFields, IdStrategy strategy)
    {
        if (typeClass.isInterface()
                || Modifier.isAbstract(typeClass.getModifiers()))
        {
            throw new RuntimeException(
                    "The root object can neither be an abstract "
                            + "class nor interface: \"" + typeClass.getName());
        }

        final ArrayList<Field<T>> fields = new ArrayList<Field<T>>(
                declaredFields.size());
        int i = 0;
        for (Map.Entry<String, String> entry : declaredFields.entrySet())
        {
            final java.lang.reflect.Field f;
            try
            {
                f = typeClass.getDeclaredField(entry.getKey());
            }
            catch (Exception e)
            {
                throw new IllegalArgumentException("Exception on field: "
                        + entry.getKey(), e);
            }

            final int mod = f.getModifiers();
            if (!Modifier.isStatic(mod) && !Modifier.isTransient(mod) && f.getAnnotation(Exclude.class) == null)
            {
                final Field<T> field = RuntimeFieldFactory.getFieldFactory(
                        f.getType(), strategy).create(++i, entry.getValue(), f,
                        strategy);
                fields.add(field);
            }
        }
        return new RuntimeSchema<T>(typeClass, fields, RuntimeEnv.newInstantiator(typeClass));
    }
827594
@SuppressWarnings("all")
    private static <T> T toNonCollectionType(Object data, Class<T> nonCollectionType) {
        if (Collection.class.isAssignableFrom(nonCollectionType)) {
            throw new RuntimeException("API使用错误，本方法不支持将目标对象转为非集合类型");
        }
        if (data == null) {
            return Defaults.defaultValue(nonCollectionType);
        }
        if (data.getClass().isArray()) {
            data = ArrayUtil.toList(data);
        }
        if (data instanceof Collection) {
            Collection collection = (Collection) data;
            if (nonCollectionType == String.class) {
                return (T) JSON.toJSONString(collection);
            }
            if (collection.isEmpty()) {
                return null;
            }
            if (collection.size() >= 2) {
                LOG.warn(new Throwable(String.format("集合 【 %s 】  的元素个数不只一个,我们只取出第一个做转换", data)));
            }
            for (Object element : collection) {
                LOG.debug("集合的第一个元素会被转为目标类型");
                return transferNonCollection(element, nonCollectionType);
            }
        } else {
            return transferNonCollection(data, nonCollectionType);
        }
        throw castFailedException(data, nonCollectionType);
    }
591623
public static <T> ArrayList<T> newArrayList(Collection<T> collection) {
		return (ArrayList<T>) list(false, collection);
	}
289717
@SuppressWarnings("unchecked")
    protected <A, Q extends SimpleExpression<? super A>> CollectionPath<A, Q> createCollection(String property, Class<? super A> type, Class<? super Q> queryType, PathInits inits) {
        return add(new CollectionPath<A, Q>(type, (Class) queryType, forProperty(property), inits));
    }
831130
public static <T> List<T> createList(final Class<T> type) {
        return new AbstractList<T>() {
            private ExtensionList<T> storage() {
                return Jenkins.getInstance().getExtensionList(type);
            }

            @Override
            public Iterator<T> iterator() {
                return storage().iterator();
            }

            public T get(int index) {
                return storage().get(index);
            }

            public int size() {
                return storage().size();
            }

            @Override
            public boolean add(T t) {
                return storage().add(t);
            }

            @Override
            public void add(int index, T t) {
                // index ignored
                storage().add(t);
            }

            @Override
            public T remove(int index) {
                return storage().remove(index);
            }

            @Override
            public boolean remove(Object o) {
                return storage().remove(o);
            }
        };
    }
1267307
private static Set<TypeMirror> nonPrivateDeclaredTypes(Types typeUtils, TypeMirror type) {
    if (type == null) {
      return new TypeMirrorSet();
    } else {
      Set<TypeMirror> declared = new TypeMirrorSet();
      declared.add(type);
      List<TypeElement> nestedTypes =
          ElementFilter.typesIn(typeUtils.asElement(type).getEnclosedElements());
      for (TypeElement nestedType : nestedTypes) {
        if (!nestedType.getModifiers().contains(PRIVATE)) {
          declared.add(nestedType.asType());
        }
      }
      for (TypeMirror supertype : typeUtils.directSupertypes(type)) {
        declared.addAll(nonPrivateDeclaredTypes(typeUtils, supertype));
      }
      return declared;
    }
  }
125512
function constructCollection(Collection, options) {
  return construct({
    input: Collection,
    expected: AmpersandCollection,
    createConstructor: collection,
    options: options
  });
}
70061
public static <T> Collection<T> addAll(Collection<T> collection, Object value) {
		return addAll(collection, value, TypeUtil.getTypeArgument(collection.getClass()));
	}
1198477
public static <E> Collection<E> iterable2coll(final Iterable<E> itrbl) {
	return new AbstractCollection<E>() {
	    public Iterator<E> iterator() {
		return itrbl.iterator();
	    }
	    public int size() {
		return DSUtil.iterableSize(itrbl);
	    }
	};
    }
1175850
def enable_collection(f):
    """"""
    @wraps(f)
    def new_f(h: AbstractHistogram1D, **kwargs):
        from physt.histogram_collection import HistogramCollection
        if isinstance(h, HistogramCollection):
            return f(h, **kwargs)
        else:
            return f(HistogramCollection(h), **kwargs)
    return new_f
619983
@NonNull
    public <T> List<T> create(@NonNull Collection<Class<? extends T>> classes) {
        final List<T> result = new ArrayList<>();
        for (Class<? extends T> clazz : classes) {
            final T instance = create(clazz);
            if (instance != null) {
                result.add(instance);
            }
        }
        return result;
    }
188213
@SuppressWarnings("unchecked")
        public <Coll extends CollectionFuncSup<T>> Coll add(T t) {
                Collection<T> coll = (Collection<T>) iterable;
                coll.add(t);
                return (Coll) this;
        }
360025
public static <T> Collection<T> distinct(Collection<? extends T> collection) {
        return new HashSet<T>(collection);
    }