Java Code Examples for java.util.Collection

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project 2Degrees-Toolbox, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: AnimatorSet.java

  32 
vote

/** 
 * Sets up this AnimatorSet to play all of the supplied animations at the same time.
 * @param items The animations that will be started simultaneously.
 */
public void playTogether(Collection<Animator> items){
  if (items != null && items.size() > 0) {
    mNeedsSort=true;
    Builder builder=null;
    for (    Animator anim : items) {
      if (builder == null) {
        builder=play(anim);
      }
 else {
        builder.with(anim);
      }
    }
  }
}
 

Example 2

From project 4308Cirrus, under directory /Extras/actionbarsherlock/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: AnimatorSet.java

  30 
vote

/** 
 * Sets up this AnimatorSet to play all of the supplied animations at the same time.
 * @param items The animations that will be started simultaneously.
 */
public void playTogether(Collection<Animator> items){
  if (items != null && items.size() > 0) {
    mNeedsSort=true;
    Builder builder=null;
    for (    Animator anim : items) {
      if (builder == null) {
        builder=play(anim);
      }
 else {
        builder.with(anim);
      }
    }
  }
}
 

Example 3

From project acceleo-modules, under directory /psm-gen-scala/plugins/com.github.sbegaudeau.acceleo.modules.psm.gen.scala.edit/src-gen/com/github/sbegaudeau/acceleo/modules/psm/gen/scala/model/scala/provider/.

Source file: ClassItemProvider.java

  29 
vote

/** 
 * This specifies how to implement  {@link #getChildren} and is used to deduce an appropriate feature for an{@link org.eclipse.emf.edit.command.AddCommand},  {@link org.eclipse.emf.edit.command.RemoveCommand} or{@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
@Override public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object){
  if (childrenFeatures == null) {
    super.getChildrenFeatures(object);
    childrenFeatures.add(ScalaPackage.Literals.CLASSIFIER__FIELDS);
    childrenFeatures.add(ScalaPackage.Literals.CLASSIFIER__METHODS);
    childrenFeatures.add(ScalaPackage.Literals.CLASS__CONSTRUCTORS);
  }
  return childrenFeatures;
}
 

Example 4

From project acceleo-webapp-generator, under directory /plugins/org.eclipse.acceleo.tutorial.webapp.edit/src-gen/org/eclipse/acceleo/tutorial/webapp/provider/.

Source file: ApplicationItemProvider.java

  29 
vote

/** 
 * This specifies how to implement  {@link #getChildren} and is used to deduce an appropriate feature for an{@link org.eclipse.emf.edit.command.AddCommand},  {@link org.eclipse.emf.edit.command.RemoveCommand} or{@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
@Override public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object){
  if (childrenFeatures == null) {
    super.getChildrenFeatures(object);
    childrenFeatures.add(WebappPackage.Literals.APPLICATION__ROUTER);
    childrenFeatures.add(WebappPackage.Literals.APPLICATION__COLLECTIONS);
    childrenFeatures.add(WebappPackage.Literals.APPLICATION__VIEWS);
    childrenFeatures.add(WebappPackage.Literals.APPLICATION__MODELS);
  }
  return childrenFeatures;
}
 

Example 5

From project accounted4, under directory /accounted4/accounted4-money/src/main/java/com/accounted4/money/.

Source file: Split.java

  29 
vote

/** 
 * The partitions forming the split.
 * @param divideType Determinant of remainder distribution among partitions
 * @return The partitions with the original money "fairly" distributed.
 */
public Collection<Money> getPartitions(final DivideType divideType){
  return new AbstractCollection<Money>(){
    @Override public Iterator<Money> iterator(){
      return new SplitIterator(divideType);
    }
    @Override public int size(){
      return partitions;
    }
  }
;
}
 

Example 6

From project AceWiki, under directory /src/ch/uzh/ifi/attempto/aceeditor/.

Source file: LexiconHandler.java

  29 
vote

public Collection<LexicalRule> getLexRules(AbstractOption option){
  String catName=option.getCategoryName();
  Collection<LexicalRule> lexRules=new ArrayList<LexicalRule>();
  if (catName.equals("def_noun_sg")) {
    for (    Word w : getWordsByCategory("noun_sg")) {
      Preterminal cat=new Preterminal("def_noun_sg");
      cat.setFeature("noun",w.getWordForm());
      cat.setFeature("text","the " + w.getWordForm());
      lexRules.add(new LexicalRule(cat,"the " + w.getWordForm()));
    }
  }
 else   if (catName.equals("var")) {
    addVariableEntries(lexRules,"var");
  }
 else   if (catName.equals("ref")) {
    addVariableEntries(lexRules,"ref");
  }
 else   if (catName.equals("num")) {
    for (int i=2; i < 100; i++) {
      lexRules.add(new LexicalRule("num",i + ""));
    }
  }
 else   if (catName.equals("adj_prep")) {
    for (    Word w : getWordsByCategory("adj_tr")) {
      Preterminal p=new Preterminal("adj_prep");
      String prep=w.getCategory().getFeature("prep").getString();
      p.setFeature("prep",prep);
      lexRules.add(new LexicalRule(p,prep));
    }
  }
 else {
    for (    Word w : getWordsByCategory(catName)) {
      lexRules.add(w.getLexicalRule());
    }
  }
  return lexRules;
}
 

Example 7

From project action-core, under directory /src/main/java/com/ning/metrics/action/schema/.

Source file: GoodwillRegistrar.java

  29 
vote

@Override public Collection<String> getAllTypes(){
  Collection<String> result=new ArrayList<String>();
  List<GoodwillSchema> goodwillSchemata=goodwillAccessor.getSchemata();
  for (  GoodwillSchema goodwillSchema : goodwillSchemata) {
    result.add(goodwillSchema.getName());
  }
  return result;
}
 

Example 8

From project ActionBarSherlock, under directory /library/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: AnimatorSet.java

  29 
vote

/** 
 * Sets up this AnimatorSet to play all of the supplied animations at the same time.
 * @param items The animations that will be started simultaneously.
 */
public void playTogether(Collection<Animator> items){
  if (items != null && items.size() > 0) {
    mNeedsSort=true;
    Builder builder=null;
    for (    Animator anim : items) {
      if (builder == null) {
        builder=play(anim);
      }
 else {
        builder.with(anim);
      }
    }
  }
}
 

Example 9

From project activemq-apollo, under directory /apollo-util/src/main/scala/org/apache/activemq/apollo/util/.

Source file: TreeMap.java

  29 
vote

public Collection<V> values(){
  return new AbstractCollection<V>(){
    @Override public Iterator<V> iterator(){
      return new ValueIterator();
    }
    @Override public int size(){
      return count;
    }
  }
;
}
 

Example 10

From project activiti, under directory /src/activiti-examples/org/activiti/examples/processdefinitions/.

Source file: ProcessDefinitionsTest.java

  29 
vote

private void deleteDeployments(Collection<String> deploymentIds){
  RepositoryService repositoryService=activitiRule.getRepositoryService();
  for (  String deploymentId : deploymentIds) {
    repositoryService.deleteDeployment(deploymentId);
  }
}
 

Example 11

From project activiti-explorer, under directory /src/main/java/org/activiti/explorer/data/.

Source file: LazyLoadingContainer.java

  29 
vote

public Collection<?> getItemIds(){
  return new AbstractList<Integer>(){
    public int size(){
      return size();
    }
    public Integer get(    int index){
      return index;
    }
  }
;
}
 

Example 12

From project addis, under directory /application/src/main/java/org/drugis/addis/entities/analysis/.

Source file: AbstractMetaAnalysis.java

  29 
vote

@Override public Set<Entity> getDependencies(){
  HashSet<Entity> deps=new HashSet<Entity>();
  Collection<Category> categories=EntityUtil.flatten(getAlternatives());
  for (  Category category : categories) {
    deps.addAll(category.getDependencies());
  }
  deps.add(getIndication());
  deps.add(getOutcomeMeasure());
  deps.addAll(getIncludedStudies());
  return deps;
}
 

Example 13

From project AdminCmd, under directory /src/main/java/be/Balor/Manager/Commands/Player/.

Source file: PlayerList.java

  29 
vote

@Override public void execute(final CommandSender sender,final CommandArgs args) throws ActionNotPermitedException, PlayerNotFound {
  final Collection<String> list=Utils.getPlayerList(sender);
  sender.sendMessage(Utils.I18n("onlinePlayers") + " " + ChatColor.WHITE+ list.size());
  final String toDisplay=Joiner.on(", ").join(list);
  if (toDisplay.length() >= ACMinecraftFontWidthCalculator.chatwidth) {
    sender.sendMessage(toDisplay.substring(0,ACMinecraftFontWidthCalculator.chatwidth));
    sender.sendMessage(toDisplay.substring(ACMinecraftFontWidthCalculator.chatwidth,toDisplay.length()));
    return;
  }
  sender.sendMessage(toDisplay);
}
 

Example 14

From project AdminStuff, under directory /src/main/java/de/minestar/AdminStuff/commands/.

Source file: cmdButcher.java

  29 
vote

private void killAll(Player player){
  Collection<LivingEntity> entities=player.getWorld().getEntitiesByClass(LivingEntity.class);
  int counter=0;
  for (  LivingEntity entity : entities) {
    if (entity instanceof Player)     continue;
    entity.remove();
    ++counter;
  }
  PlayerUtils.sendSuccess(player,pluginName,"Es wurden " + counter + " Monster entfernt.");
}
 

Example 15

From project AdServing, under directory /modules/db/src/main/java/net/mad/ads/db/utils/.

Source file: ConditionHelper.java

  29 
vote

/** 
 * F?hrt alle definierten Filter auf das Ergebnis der Bannersuche aus
 * @param request
 * @param banners
 * @return
 */
public List<AdDefinition> processFilter(AdRequest request,List<AdDefinition> banners,AdDB db){
  if (!request.hasConditions()) {
    return banners;
  }
  Collection<AdDefinition> bcol=new ArrayList<AdDefinition>();
  bcol.addAll(banners);
  for (  Condition condition : db.manager.getConditions()) {
    if (Filter.class.isInstance(condition) && !banners.isEmpty()) {
      bcol=(Collection<AdDefinition>)Collections2.filter(bcol,((Filter)condition).getFilterPredicate(request));
    }
  }
  banners.clear();
  banners.addAll(bcol);
  return banners;
}
 

Example 16

From project advanced, under directory /management/src/main/java/org/neo4j/management/impl/.

Source file: BeanProxy.java

  29 
vote

public static <T>Collection<T> loadAll(MBeanServerConnection mbs,Class<T> beanInterface,ObjectName query){
  Collection<T> beans=new LinkedList<T>();
  try {
    for (    ObjectName name : mbs.queryNames(query,null)) {
      beans.add(factory.makeProxy(mbs,beanInterface,name));
    }
  }
 catch (  IOException e) {
  }
  return beans;
}
 

Example 17

From project AeminiumRuntime, under directory /src/aeminium/runtime/implementations/implicitworkstealing/.

Source file: ImplicitWorkStealingRuntime.java

  29 
vote

@Override public final void schedule(Task task,Task parent,Collection<Task> deps){
  if (enableGraphViz) {
    ImplicitTask itask=(ImplicitTask)task;
    digraphviz.addNode(itask.hashCode(),itask.body.toString());
    if (parent != NO_PARENT) {
      digraphviz.addConnection(itask.hashCode(),parent.hashCode(),LineStyle.DASHED,Color.RED,"");
    }
    if (deps != NO_DEPS) {
      for (      Task dep : deps) {
        digraphviz.addConnection(itask.hashCode(),dep.hashCode(),LineStyle.SOLID,Color.BLUE,"");
      }
    }
  }
  graph.addTask((ImplicitTask)task,parent,deps);
}
 

Example 18

From project aerogear-controller, under directory /src/main/java/org/jboss/aerogear/controller/util/.

Source file: TypeNameExtractor.java

  29 
vote

private String nameFor(ParameterizedType type){
  Class<?> raw=(Class<?>)type.getRawType();
  if (Collection.class.isAssignableFrom(raw)) {
    return nameFor(type.getActualTypeArguments()[0]) + "List";
  }
  return nameFor(raw);
}
 

Example 19

From project aether-ant, under directory /src/main/java/org/eclipse/aether/ant/.

Source file: AntRepoSys.java

  29 
vote

private AuthenticationSelector getAuthSelector(){
  DefaultAuthenticationSelector selector=new DefaultAuthenticationSelector();
  Collection<String> ids=new HashSet<String>();
  for (  Authentication auth : authentications) {
    List<String> servers=auth.getServers();
    if (!servers.isEmpty()) {
      org.eclipse.aether.repository.Authentication a=ConverterUtils.toAuthentication(auth);
      for (      String server : servers) {
        if (ids.add(server)) {
          selector.add(server,a);
        }
      }
    }
  }
  Settings settings=getSettings();
  for (  Server server : settings.getServers()) {
    AuthenticationBuilder auth=new AuthenticationBuilder();
    auth.addUsername(server.getUsername()).addPassword(server.getPassword());
    auth.addPrivateKey(server.getPrivateKey(),server.getPassphrase());
    selector.add(server.getId(),auth.build());
  }
  return new ConservativeAuthenticationSelector(selector);
}
 

Example 20

From project aether-core, under directory /aether-api/src/main/java/org/eclipse/aether/collection/.

Source file: UnsolvableVersionConflictException.java

  29 
vote

public UnsolvableVersionConflictException(Object dependencyConflictId,Collection<String> versions){
  super("Could not resolve version conflict for " + dependencyConflictId + " with requested versions "+ toList(versions));
  this.dependencyConflictId=(dependencyConflictId != null) ? dependencyConflictId : "";
  this.versions=(versions != null) ? versions : Collections.<String>emptyList();
  this.paths=Collections.emptyList();
}