Tutorial
Using mdTypes [EN]
| von  MOD | Seite 3 von 12 | 
mdIterator allows to iterate easily through the list classes. Moreover it defined a ForEach macro, which allows a Java-like syntax.
mdArrayIterator extends the mdIterator class and also the ForEach macro. Using this class you can also iterate through FreeBASIC arrays of any type.
mdEnumeration is almost the same like mdIterator. Most times you will use mdIterator, but in some cases methods will return mdEnumerations.
Some examples:
mdIterator:
#Include Once "md/util/mdList.bi"
mdListDeclare(String)
Dim As mdList(String) list
list.add("0")
list.add("1")
list.add("2")
list.add("3")
list.add("4")
list.add("5")
Dim As mdIterator(String) it = list.iterator()
'First iteration
While it.hasNext()
    Print it.nex()
Wend
'Second iteration
Dim As String element
ForEach(String, element In list)
    Print element
NextEach
Sleep
mdArrayIterator:
#Include Once "md/util/mdArrayIterator.bi"
mdArrayIteratorDeclare(String)
Dim As String array(0 To 9)
For i As Integer = 0 To 9
    array(i) = Str(i)
Next
Dim As mdArrayIterator(String) it = array()
'First iteration
While it.hasNext()
    Print it.nex()
Wend
'Second iteration
Dim As String element
ForEach(String, element In array())
    Print element
NextEach
Sleep
mdEnumeration:
#Include "md/util/mdEnumeration.bi"
mdEnumerationDeclare(String)
Dim As mdList(String) list
list.add("0")
list.add("1")
list.add("2")
list.add("3")
list.add("4")
Dim As mdEnumeration(String) e = list
While e.hasMoreElements()
    Print e.nextElement
Wend
Sleep
| Zusätzliche Informationen und Funktionen | |||||||
|---|---|---|---|---|---|---|---|
| 
 
 | |||||||

 Wer ist online?
 Wer ist online? Buchempfehlung
 Buchempfehlung
 FreeBASIC-Chat
 FreeBASIC-Chat
 FreeBASIC-Nachrichten jetzt auch über Twitter erhalten. Follow us!
			FreeBASIC-Nachrichten jetzt auch über Twitter erhalten. Follow us! Gehe zu Seite
 Gehe zu Seite   Bearbeiten
 Bearbeiten Versionen
 Versionen