Java   View all facts   Glossary   Help
specification > interface > Iterator
Next interfaceRunnable    Upinterface    Previous interfaceSerializable   

Iterator
subjectfact 
Iteratorhas example
//counts the number of empty strings in a collection of strings
emptyCount = 0;
Iterator i = aCollection.iterator();
while(i.hasNext())
{
if(((String)i.next()).length()==0)
emptyCount++;
}
  
source: Object Oriented Software Engineering by Lethbridge and Laganière, 2001-10-19 11:37:02.0
has remove method that allows you to selectively delete elements of the underlying collection    source: Object Oriented Software Engineering by Lethbridge and Laganière, 2001-10-19 11:37:02.0
is a subtopic of Example Interfaces2001-10-19 11:37:02.0
is an instance of interfacesource: Object Oriented Software Engineering by Lethbridge and Laganière, 2001-10-19 11:37:02.0
interfacecan contain abstract methods2001-10-19 11:36:59.0
can extend 1 or more interfaces    2001-10-19 11:36:59.0
cannot have any concrete methods or instance variables    2001-10-19 11:36:59.0
defines a set of methods2001-10-19 11:36:59.0
has 1 fully qualified name that includes its package name2001-10-19 11:36:59.0
has 1 simple name that does not include its package name2001-10-19 11:37:00.0
has part interface definition2001-10-19 11:37:00.0
has purpose    2001-10-19 11:37:00.0
has syntax
public interface InterfaceName extends SuperInterfaces
{
InterfaceBody
}
2001-10-19 11:37:00.0
inherits all constants and methods from its superinterfaces    2001-10-19 11:37:00.0
is like a class except that it does not have any executable statements - it only contains abstract methods and class variables    2001-10-19 11:37:00.0
is abstract by definition - the modifier is optional in the declaration2001-10-19 11:37:00.0
is a member of the default package unless its source file contains a package statement2001-10-19 11:37:00.0
is only accessible to classes that are defined in the same package unless the interface is public    2001-10-19 11:37:00.0
is compiled by the Java compiler into a .class file2001-10-19 11:37:00.0
is implemented by 1 or more class2001-10-19 11:37:00.0
may have 1 or more superinterfaces2001-10-19 11:37:00.0
may have access modifier public, or none2001-10-19 11:37:00.0
provides many of the same benefits as multiple inheritance    2001-10-19 11:37:00.0
should be a member of 1 named package2001-10-19 11:37:00.0
access unithas access mode2001-10-19 11:35:59.0
syntactic unithas syntax rule
bold = mandatory
italic = non-terminal
normal font = optional
2001-10-19 11:38:04.0

Next interfaceRunnable    Upinterface    Previous interfaceSerializable