String
boolean - contains(String str)
如果字符串包含特定序列或字符返回true
"fx is great".contains("fx")
true
boolean- endsWith(String str)
检测是否以特定字符串结尾
"fx is great".endsWith("great")
true
boolean-satrtsWith(String regex)
检测是否以特定字符串开头
"fx is great".startsWith("fx")
true
String- concat(String str)
将指定的字符串,此字符串的末尾。
"fx is great".concat("!!!")
fx is great!!!
int- indexof(Object o,)
返回从指定位置起,第一个匹配字符串的位置
"fx is excellent in crm".indexOf("i",7)
16
boolean- isEmpty()
判断是否为空
"fx".isEmpty()
false
int-compareTo(Object o)
比较,大于比较参数返回1,小于返回-1,等于返回0
2.compareTo(3)
-1
int-length()
返回字符串长度
"fexiaoke".length()
8
String-replace(String target,String replacement)
替换指定字符串
"fexiaoke is great".replace("fexiaoke","fs")
fs is great
list-split(String regx)
将此字符串按regex分割为list。
"fx welcome you".split(" ")
[fx, welcome, you]
String-substring(int beginIndex,int endIndex)
子字符串以指定索引处的字符开头和结尾
"fxiaoke".substring(2,5)
iao
List
boolean-add(,E e)
向集合添加元素
list = [1,2,3]
list.add(4)
boolean-addAll(Collection
list1 = [1,2,3]
list2 = [4,5]
list1.addAll(list2)
void-clear()
清空值
list = [1,2,3]
list.clear()
boolen-contains(Object o)
判断是否包含匹配内容
list = [1,2,3]
list.contains(1)
true
boolean-containsAll(Collection
list = [1,2,3]
list.containsAll([1,4])
false
boolean-equals(Object o)
判断是否相等
"1".equals(1)
false
E-get(int index)
获取集合指定位置元素
list = [1,2,3]
list.get(0)
1
int-hashCode()
返回此列表的哈希码值
list = [1,2,3]
list.hashCode()
30817
indexof-(Object 0)
返回指定元素位置
"qweeqwe".indexOf("w")
1
boolean-isEmpty()
判断是否为空
E- remove(int index)
移除指定位置的元素
E- remove(Object o)
移除指定元素
boolean-removeAll(Collection
int-size()
返回集合元素个数
Map
V- putIfVbsent(K key,V value)
如果key存在的情况下,在putIfVbsent下不会修改
Map map = new HashMap()
map.putIfAbsent("1",1)
map.putIfAbsent("2",2)
map.put("1",2)
map.putIfAbsent("2",3)
print map.toString()
[1:2, 2:2]
void-clear()
清空Map
boolean-containsKey(Object key)
是否包含key
map.containsKey("3")
false
boolean-containsValue(Object value)
是否包含value
V-get(Object key)
以键取值
V-put(K key,V value)
存放K-V
void-putAll(Map m)
存放一个map
V-remove(Object key)
按键移除指定K-V,返回移除的key
map.remove("1")
2
boolean-remove(Object key, Object value)
移除指定的K-V,没有返回false
map.remove("1",2)
true
int-size()
返回Map元素个数
Collection- values()
返回所有值的集合
map.values().toString()
[2,2]