首页 > 文档 > IntList整数型列表类
2017
07-17

IntList整数型列表类

Name IntList整数型列表类
Examples IntList inventory;

void setup() {

size(200, 200);

inventory = new IntList();

inventory.append(84);

inventory.append(15);

inventory.append(102);

println(inventory);

noLoop();

fill(0);

textAlign(CENTER);

}

void draw() {

int nums = inventory.get(2);

text(nums, width/2, height/2);

}


Description Helper class for a list of ints. Lists are designed to have some of the features of ArrayLists, but to maintain the simplicity and efficiency of working with arrays.

Functions like sort() and shuffle() always act on the list itself. To get a sorted copy, use list.copy().sort().

整数列表的帮助器类。列表被设计为具有 ArrayLists 的一些功能, 但要保持使用数组的简单性和效率。

排序 () 和无序 () 之类的函数总是在列表本身上执行。若要获取已排序的副本, 请使用列表. 复制 (). 排序 ()

Methods
size() Get the length of the list获取表的长度
clear() Remove all entries from the list清空表
get() Get an entry at a particular index获取特定索引处的条目
set() Set the entry at a particular index在特定索引处设置条目
remove() Remove an element from the specified index在特定索引处移除条目
append() Add a new entry to the list向列表中添加新项
hasValue() Check if a number is a part of the list检查数字是否为列表的一部分
increment() Add one to a value将一个值添加到
add() Add to a value加
sub() Subtract from a value减
mult() Multiply a value乘
div() Divide a value除
min() Return the smallest value最小
max() Return the largest value最大
sort() Sorts the array, lowest to highest排序
sortReverse() Reverse sort, orders values from highest to lowest反向排序
reverse() Reverse the order of the list elements反转列表元素的顺序
shuffle() Randomize the order of the list elements随机化列表元素的顺序
array() Create a new array with a copy of all the values创建一个包含所有值的副本的新数组
Constructor IntList()

IntList(items)

Related FloatList
StringList


最后编辑:
作者:卡萨布兰卡
这个作者貌似有点懒,什么都没有留下。

留下一个回复

你的email不会被公开。