List of usage examples for com.google.common.collect Constraints constrainedList
public static <E> List<E> constrainedList(List<E> list, Constraint<? super E> constraint)
From source file:com.prealpha.minelib.nbt.ListTag.java
public ListTag(Type elementType) { checkNotNull(elementType);/*from w w w.j a v a 2s.c o m*/ this.elementType = elementType; List<Tag> baseList = Lists.newArrayList(); Constraint<Tag> constraint = new TypeConstraint(); value = Constraints.constrainedList(baseList, constraint); }
From source file:util.ListUtil.java
public static <T> List<T> newNotNullLinkedList() { return Constraints.constrainedList(new LinkedList<T>(), Constraints.notNull()); }
From source file:com.prealpha.minelib.nbt.ListTag.java
public ListTag(Collection<? extends Tag> collection) { checkArgument(!collection.isEmpty()); List<Tag> baseList = Lists.newArrayList(collection); elementType = baseList.get(0).getTagType(); Constraint<Tag> constraint = new TypeConstraint(); for (Tag tag : baseList) { constraint.checkElement(tag);//from www .j av a 2s . co m } value = Constraints.constrainedList(baseList, constraint); }
From source file:org.richfaces.cdk.ProcessMojo.java
protected URL[] getProjectClassPath() { try {/*from w ww .j a v a 2s. c om*/ List<String> classpath = Constraints.constrainedList(Lists.<String>newArrayList(), MoreConstraints.cast(String.class)); classpath.addAll((List<String>) project.getCompileClasspathElements()); classpath.add(project.getBuild().getOutputDirectory()); URL[] urlClasspath = filter(transform(classpath, filePathToURL), notNull()).toArray(EMPTY_URL_ARRAY); return urlClasspath; } catch (DependencyResolutionRequiredException e) { getLog().error("Dependencies not resolved ", e); } return new URL[0]; }