Skip to content
Reference > Classes

Iterable

Definition

Iterable var = .... ;

Extends

Extended By

Method Summary

Owner Name Return Type Description
Object getClassName() String Returns the string name of this object's class type.
Iterable iterator() Iterator Returns an iterator over this container's objects. Methods are defined in the Iterator class.
Object toJson() String Returns a string of a json representation of this object.

Method Definitions


getClassName()

String Object::getClassName()

Description

Returns the string name of this object's class type.

Example 18

1
2
3
4
5
Set s = new Set("a", "b", "c");
Iterable i = s;
i.getClassName();

// i.getClassName() = Set

Example 19

1
2
3
4
5
List l = new List("a", "b", "c");
Iterable i = l;
i.getClassName();

// i.getClassName() = List

iterator()

Iterator Iterable::iterator()

Description

Returns an iterator over this container's objects. Methods are defined in the Iterator class.

Example 2

1
2
3
4
5
6
7
8
Set s = new Set("3","f","o","r","g","e");
Iterator i = s.iterator();
string temp = "";
while(i.hasNext()) { 
    temp += i.next();
}
// i.hasNext() = false
// temp = 3forge

toJson()

String Object::toJson()

Description

Returns a string of a json representation of this object.

Example 18

1
2
3
4
5
Set s = new Set("a", "b", "c");
Iterable i = s;
i.toJson();

// i.toJson() = ["a","b","c"]

Example 19

1
2
3
4
5
List l = new List("a", "b", "c");
Iterable i = l;
i.toJson();

// i.toJson() = ["a","b","c"]