Key-Value是用一个不可重复的key集合对应可重复的value集合。(典型的例子是字典:通过页码的key值找字的value值)。
例子:
key1—value1;
key2—value2;
key3—value3.
SortedMap:如果一个Map可以根据key值排序,则称其为SortedMap。(如字典)
!!注意数组和集合的区别:数组中只能存简单数据类型。Collection接口和Map接口只能存对象。
package TomTexts;public class TomTexts_04 {public static void main(String[] args) {String s1=\"aaaa\";String s2=\"aaaa\";String s3=\"AAAA\";String s4=\"bcd\";if (s1.equals(s2)) {System.out.println(\"s1==s2\");}else {System.out.println(\"s1!=s2\");}if (s1.equalsIgnoreCase(s3)) {System.out.println(\" s1= =s3 when ignoring case\");}else {System.out.println(\" s1!=s3 when ignoring case\");}if (s1.regionMatches(true,0,s3,1,3)) {System.out.println(\" s1= =s3 when ignoring case\");}else {System.out.println(\" s1!=s3 when ignoring case\");}if (s1.regionMatches(false,0,s3,1,3)) {System.out.println(\" s1= =s3 when not ignoring case\");}else {System.out.println(\"s1!=s3 when not ignoring case\");}if (s1.compareTo(s4)<0) {System.out.println(\" s1<s4\");}else if (s1.compareTo(s4)==0){System.out.println(\"s1= =s4\");}else {System.out.println(\"s1>s4\");}}}