Skip to content

Commit 467c0dd

Browse files
committed
Reference additions for Lists and Dicts
1 parent 2766c40 commit 467c0dd

29 files changed

+270
-40
lines changed

content/api_en/FloatDict_keys.xml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,16 @@ void setup() {
2121
size(200, 200);
2222
inventory = new FloatDict(goods, amounts);
2323
println(inventory);
24-
String[] theKeys = inventory.keys();
25-
println(theKeys);
24+
for (String k : inventory.keys()) {
25+
println(k);
26+
}
2627
}
2728
2829
]]></code>
2930
</example>
3031

3132
<description><![CDATA[
32-
Return the internal array being used to store the keys. Allocated
33-
but unused entries will be removed. In contrast to the <b>keyArray()</b>
34-
method, this array should not be modified.
33+
Return the internal array being used to store the keys.
3534
]]></description>
3635

3736
</root>

content/api_en/FloatDict_values.xml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,25 @@
1212
<example>
1313
<image></image>
1414
<code><![CDATA[
15-
To come...
15+
String[] goods = { "coffee", "flour", "tea"};
16+
float[] amounts = { 108.6, 5.8, 8.2 };
17+
18+
FloatDict inventory;
19+
20+
void setup() {
21+
size(200, 200);
22+
inventory = new FloatDict(goods, amounts);
23+
println(inventory);
24+
for (float f : inventory.values()) {
25+
println(f);
26+
}
27+
}
28+
1629
]]></code>
1730
</example>
1831

1932
<description><![CDATA[
20-
To come...
33+
Return the internal array being used to store the values.
2134
]]></description>
2235

2336
</root>

content/api_en/FloatList.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ void draw() {
3333
</example>
3434

3535
<description><![CDATA[
36-
Helper class for a list of Floats. By design (for efficiency), functions like <b>sort()</b> and <b>shuffle()</b> always act on the list itself. To get a sorted copy, use list.copy().sort(). There are more methods listed in the Processing JavaDoc.
36+
Helper class for a list of floats. Lists are designed to have some of the
37+
features of ArrayLists, but to maintain the simplicity and efficiency of
38+
working with arrays. <br />
39+
<br />
40+
Functions like sort() and shuffle() always act on the list itself. To get
41+
a sorted copy, use list.copy().sort().
3742
]]></description>
3843

3944

content/api_en/FloatList_add.xml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,17 @@
1212
<example>
1313
<image></image>
1414
<code><![CDATA[
15-
To come...
15+
float[] numbers = { 108.6, 5.8, 8.2 };
16+
FloatList inventory;
17+
18+
void setup() {
19+
size(200, 200);
20+
inventory = new FloatList(numbers);
21+
println(inventory);
22+
inventory.add(2, 2.4);
23+
println(inventory);
24+
}
25+
1626
]]></code>
1727
</example>
1828

content/api_en/FloatList_append.xml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,17 @@
1212
<example>
1313
<image></image>
1414
<code><![CDATA[
15-
To come...
15+
float[] numbers = { 108.6, 5.8, 8.2 };
16+
FloatList inventory;
17+
18+
void setup() {
19+
size(200, 200);
20+
inventory = new FloatList(numbers);
21+
println(inventory);
22+
inventory.append(3.14);
23+
println(inventory);
24+
}
25+
1626
]]></code>
1727
</example>
1828

content/api_en/FloatList_array.xml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,18 @@
1212
<example>
1313
<image></image>
1414
<code><![CDATA[
15-
To come...
15+
float[] numbers = { 108.6, 5.8, 8.2 };
16+
FloatList inventory;
17+
18+
void setup() {
19+
size(200, 200);
20+
inventory = new FloatList(numbers);
21+
println(inventory);
22+
inventory.sort();
23+
float[] sortedInventory = inventory.array();
24+
println(sortedInventory);
25+
}
26+
1627
]]></code>
1728
</example>
1829

content/api_en/FloatList_clear.xml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,17 @@
1212
<example>
1313
<image></image>
1414
<code><![CDATA[
15-
To come...
15+
float[] numbers = { 108.6, 5.8, 8.2 };
16+
FloatList inventory;
17+
18+
void setup() {
19+
size(200, 200);
20+
inventory = new FloatList(numbers);
21+
println(inventory);
22+
inventory.clear();
23+
println(inventory);
24+
}
25+
1626
]]></code>
1727
</example>
1828

content/api_en/FloatList_div.xml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,17 @@
1212
<example>
1313
<image></image>
1414
<code><![CDATA[
15-
To come...
15+
float[] numbers = { 108.6, 5.8, 8.2 };
16+
FloatList inventory;
17+
18+
void setup() {
19+
size(200, 200);
20+
inventory = new FloatList(numbers);
21+
println(inventory);
22+
inventory.div(0, 2);
23+
println(inventory);
24+
}
25+
1626
]]></code>
1727
</example>
1828

content/api_en/FloatList_hasValue.xml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,20 @@
1212
<example>
1313
<image></image>
1414
<code><![CDATA[
15-
To come...
15+
float[] numbers = { 108.6, 5.8, 8.2 };
16+
FloatList inventory;
17+
18+
void setup() {
19+
size(200, 200);
20+
inventory = new FloatList(numbers);
21+
println(inventory);
22+
if (inventory.hasValue(5.8) == true) {
23+
println("Yes, we have a '5.8'");
24+
} else {
25+
println("Sorry, no '5.8'");
26+
}
27+
}
28+
1629
]]></code>
1730
</example>
1831

content/api_en/FloatList_max.xml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,17 @@
1212
<example>
1313
<image></image>
1414
<code><![CDATA[
15-
To come...
15+
float[] numbers = { 108.6, 5.8, 8.2 };
16+
FloatList inventory;
17+
18+
void setup() {
19+
size(200, 200);
20+
inventory = new FloatList(numbers);
21+
println(inventory);
22+
float largest = inventory.max();
23+
println(largest);
24+
}
25+
1626
]]></code>
1727
</example>
1828

0 commit comments

Comments
 (0)