package bluej.pkgmgr.target;
import java.util.*;
import threadchecker.OnThread;
import threadchecker.Tag;
| A collection of targets.
|
| @author Andrew Patterson
|
@OnThread(Tag.Any)
public class TargetCollection implements Iterable<Target>{
| all the targets in a package
|
protected HashMap<String,Target> targets = new HashMap<String,Target>();
| Obtain an iterator that can be used to iterate through the targets in the
| collection. The iterator becomes invalid if the collection is modified
| (including if a target is renamed).
|
public Iterator iterator()
{
return targets.values().iterator();
}
| Get a list of the targets currently in the collection.
|
public List toList()
{
return new ArrayList<>(targets.values());
}
public Target get(String identifierName)
{
return (Target) targets.get(identifierName);
}
public Target remove(String identifierName)
{
return (Target) targets.remove(identifierName);
}
public void add(String identifierName, Target target)
{
targets.put(identifierName, target);
}
public String toString()
{
return targets.toString();
}
}
. iterator
. toList
. get
. remove
. add
. toString
52 neLoCode
+ 7 LoComm