当前位置: 首页 > news >正文

西安金融网站建设专业网站建设空间

西安金融网站建设,专业网站建设空间,wordpress 文章中图片居中,建站工具哪个最好1. 集合框架概述 1.1 生活中的容器 1.2 数组的特点与弊端 一方面#xff0c;面向对象语言对事物的体现都是以对象的形式#xff0c;为了方便对多个对象的操作#xff0c;就要对对象进行存储。另一方面#xff0c;使用数组存储对象方面具有一些弊端#xff0c;而Java 集合…1. 集合框架概述 1.1 生活中的容器 1.2 数组的特点与弊端 一方面面向对象语言对事物的体现都是以对象的形式为了方便对多个对象的操作就要对对象进行存储。另一方面使用数组存储对象方面具有一些弊端而Java 集合就像一种容器可以动态地把多个对象的引用放入容器中。数组在内存存储方面的特点 数组初始化以后长度就确定了。数组中的添加的元素是依次紧密排列的有序的可以重复的。数组声明的类型就决定了进行元素初始化时的类型。不是此类型的变量就不能添加。可以存储基本数据类型值也可以存储引用数据类型的变量 数组在存储数据方面的弊端 数组初始化以后长度就不可变了不便于扩展数组中提供的属性和方法少不便于进行添加、删除、插入、获取元素个数等操作且效率不高。数组存储数据的特点单一只能存储有序的、可以重复的数据 Java 集合框架中的类可以用于存储多个对象还可用于保存具有映射关系的关联数组。 1.3 Java集合框架体系 Java 集合可分为 Collection 和 Map 两大体系 Collection接口用于存储一个一个的数据也称单列数据集合。 List子接口用来存储有序的、可以重复的数据主要用来替换数组动态数组 实现类ArrayList(主要实现类)、LinkedList、Vector Set子接口用来存储无序的、不可重复的数据类似于高中讲的集合 实现类HashSet(主要实现类)、LinkedHashSet、TreeSet Map接口用于存储具有映射关系“key-value对”的集合即一对一对的数据也称双列数据集合。(类似于高中的函数、映射。(x1,y1),(x2,y2) — y f(x) ) HashMap(主要实现类)、LinkedHashMap、TreeMap、Hashtable、Properties JDK提供的集合API位于java.util包内 图示集合框架全图 简图1Collection接口继承树 简图2Map接口继承树 1.4 集合的使用场景 2. Collection接口及方法 JDK不提供此接口的任何直接实现而是提供更具体的子接口如Set和List去实现。Collection 接口是 List和Set接口的父接口该接口里定义的方法既可用于操作 Set 集合也可用于操作 List 集合。方法如下 2.1 添加 1add(E obj)添加元素对象到当前集合中 2addAll(Collection other)添加other集合中的所有元素对象到当前集合中即this this ∪ other 注意add和addAll的区别 import org.junit.Test;import java.util.ArrayList; import java.util.Collection;public class TestCollectionAdd {Testpublic void testAdd(){//ArrayList是Collection的子接口List的实现类之一。Collection coll new ArrayList();coll.add(小李广);coll.add(扫地僧);coll.add(石破天);System.out.println(coll);}Testpublic void testAddAll(){Collection c1 new ArrayList();c1.add(1);c1.add(2);System.out.println(c1集合元素的个数 c1.size());//2System.out.println(c1 c1);Collection c2 new ArrayList();c2.add(1);c2.add(2);System.out.println(c2集合元素的个数 c2.size());//2System.out.println(c2 c2);Collection other new ArrayList();other.add(1);other.add(2);other.add(3);System.out.println(other集合元素的个数 other.size());//3System.out.println(other other);System.out.println();c1.addAll(other);System.out.println(c1集合元素的个数 c1.size());//5System.out.println(c1.addAll(other) c1);c2.add(other);System.out.println(c2集合元素的个数 c2.size());//3System.out.println(c2.add(other) c2);} }注意coll.addAll(other);与coll.add(other); 2.2 判断 3int size()获取当前集合中实际存储的元素个数 4boolean isEmpty()判断当前集合是否为空集合 5boolean contains(Object obj)判断当前集合中是否存在一个与obj对象equals返回true的元素 6boolean containsAll(Collection coll)判断coll集合中的元素是否在当前集合中都存在。即coll集合是否是当前集合的“子集” 7boolean equals(Object obj)判断当前集合与obj是否相等 import org.junit.Test;import java.util.ArrayList; import java.util.Arrays; import java.util.Collection;public class TestCollectionContains {Testpublic void test01() {Collection coll new ArrayList();System.out.println(coll在添加元素之前isEmpty coll.isEmpty());coll.add(小李广);coll.add(扫地僧);coll.add(石破天);coll.add(佛地魔);System.out.println(coll的元素个数 coll.size());System.out.println(coll在添加元素之后isEmpty coll.isEmpty());}Testpublic void test02() {Collection coll new ArrayList();coll.add(小李广);coll.add(扫地僧);coll.add(石破天);coll.add(佛地魔);System.out.println(coll coll);System.out.println(coll是否包含“小李广” coll.contains(小李广));System.out.println(coll是否包含“宋红康” coll.contains(宋红康));Collection other new ArrayList();other.add(小李广);other.add(扫地僧);other.add(XXXX);System.out.println(other other);System.out.println(coll.containsAll(other) coll.containsAll(other));}Testpublic void test03(){Collection c1 new ArrayList();c1.add(1);c1.add(2);System.out.println(c1集合元素的个数 c1.size());//2System.out.println(c1 c1);Collection c2 new ArrayList();c2.add(1);c2.add(2);System.out.println(c2集合元素的个数 c2.size());//2System.out.println(c2 c2);Collection other new ArrayList();other.add(1);other.add(2);other.add(3);System.out.println(other集合元素的个数 other.size());//3System.out.println(other other);System.out.println();c1.addAll(other);System.out.println(c1集合元素的个数 c1.size());//5System.out.println(c1.addAll(other) c1);System.out.println(c1.contains(other) c1.contains(other));System.out.println(c1.containsAll(other) c1.containsAll(other));System.out.println();c2.add(other);System.out.println(c2集合元素的个数 c2.size());System.out.println(c2.add(other) c2);System.out.println(c2.contains(other) c2.contains(other));System.out.println(c2.containsAll(other) c2.containsAll(other));}}2.3 删除 8void clear()清空集合元素 9 boolean remove(Object obj) 从当前集合中删除第一个找到的与obj对象equals返回true的元素。 10boolean removeAll(Collection coll)从当前集合中删除所有与coll集合中相同的元素。即this this - this ∩ coll 11boolean retainAll(Collection coll)从当前集合中删除两个集合中不同的元素使得当前集合仅保留与coll集合中的元素相同的元素即当前集合中仅保留两个集合的交集即this this ∩ coll 注意几种删除方法的区别 import org.junit.Test;import java.util.ArrayList; import java.util.Collection; import java.util.function.Predicate;public class TestCollectionRemove {Testpublic void test01(){Collection coll new ArrayList();coll.add(小李广);coll.add(扫地僧);coll.add(石破天);coll.add(佛地魔);System.out.println(coll coll);coll.remove(小李广);System.out.println(删除元素\小李广\之后coll coll);coll.clear();System.out.println(coll清空之后coll coll);}Testpublic void test02() {Collection coll new ArrayList();coll.add(小李广);coll.add(扫地僧);coll.add(石破天);coll.add(佛地魔);System.out.println(coll coll);Collection other new ArrayList();other.add(小李广);other.add(扫地僧);other.add(XXXX);System.out.println(other other);coll.removeAll(other);System.out.println(coll.removeAll(other)之后coll coll);System.out.println(coll.removeAll(other)之后other other);}Testpublic void test03() {Collection coll new ArrayList();coll.add(小李广);coll.add(扫地僧);coll.add(石破天);coll.add(佛地魔);System.out.println(coll coll);Collection other new ArrayList();other.add(小李广);other.add(扫地僧);other.add(XXXX);System.out.println(other other);coll.retainAll(other);System.out.println(coll.retainAll(other)之后coll coll);System.out.println(coll.retainAll(other)之后other other);}}2.4 其它 12Object[] toArray()返回包含当前集合中所有元素的数组 13hashCode()获取集合对象的哈希值 14iterator()返回迭代器对象用于集合遍历 public class TestCollectionContains {Testpublic void test01() {Collection coll new ArrayList();coll.add(小李广);coll.add(扫地僧);coll.add(石破天);coll.add(佛地魔);//集合转换为数组集合的toArray()方法Object[] objects coll.toArray();System.out.println(用数组返回coll中所有元素 Arrays.toString(objects));//对应的数组转换为集合调用Arrays的asList(Object ...objs)Object[] arr1 new Object[]{123,AA,CC};Collection list Arrays.asList(arr1);System.out.println(list);} }3. Iterator(迭代器)接口 3.1 Iterator接口 在程序开发中经常需要遍历集合中的所有元素。针对这种需求JDK专门提供了一个接口java.util.Iterator。Iterator接口也是Java集合中的一员但它与Collection、Map接口有所不同。 Collection接口与Map接口主要用于存储元素Iterator被称为迭代器接口本身并不提供存储对象的能力主要用于遍历Collection中的元素 Collection接口继承了java.lang.Iterable接口该接口有一个iterator()方法那么所有实现了Collection接口的集合类都有一个iterator()方法用以返回一个实现了Iterator接口的对象。 public Iterator iterator(): 获取集合对应的迭代器用来遍历集合中的元素的。集合对象每次调用iterator()方法都得到一个全新的迭代器对象默认游标都在集合的第一个元素之前。 Iterator接口的常用方法如下 public E next():返回迭代的下一个元素。public boolean hasNext():如果仍有元素可以迭代则返回 true。 注意在调用it.next()方法之前必须要调用it.hasNext()进行检测。若不调用且下一条记录无效直接调用it.next()会抛出NoSuchElementException异常。 举例 import org.junit.Test;import java.util.ArrayList; import java.util.Collection; import java.util.Iterator;public class TestIterator {Testpublic void test01(){Collection coll new ArrayList();coll.add(小李广);coll.add(扫地僧);coll.add(石破天);Iterator iterator coll.iterator();System.out.println(iterator.next());System.out.println(iterator.next());System.out.println(iterator.next());System.out.println(iterator.next()); //报NoSuchElementException异常}Testpublic void test02(){Collection coll new ArrayList();coll.add(小李广);coll.add(扫地僧);coll.add(石破天);Iterator iterator coll.iterator();//获取迭代器对象while(iterator.hasNext()) {//判断是否还有元素可迭代System.out.println(iterator.next());//取出下一个元素}} } 3.2 迭代器的执行原理 Iterator迭代器对象在遍历集合时内部采用指针的方式来跟踪集合中的元素接下来通过一个图例来演示Iterator对象迭代元素的过程 使用Iterator迭代器删除元素java.util.Iterator迭代器中有一个方法void remove() ; Iterator iter coll.iterator();//回到起点 while(iter.hasNext()){Object obj iter.next();if(obj.equals(Tom)){iter.remove();} }注意 Iterator可以删除集合的元素但是遍历过程中通过迭代器对象的remove方法不是集合对象的remove方法。 如果还未调用next()或在上一次调用 next() 方法之后已经调用了 remove() 方法再调用remove()都会报IllegalStateException。 Collection已经有remove(xx)方法了为什么Iterator迭代器还要提供删除方法呢因为迭代器的remove()可以按指定的条件进行删除。 例如要删除以下集合元素中的偶数 import org.junit.Test;import java.util.ArrayList; import java.util.Collection; import java.util.Iterator;public class TestIteratorRemove {Testpublic void test01(){Collection coll new ArrayList();coll.add(1);coll.add(2);coll.add(3);coll.add(4);coll.add(5);coll.add(6);Iterator iterator coll.iterator();while(iterator.hasNext()){Integer element (Integer) iterator.next();if(element % 2 0){iterator.remove();}}System.out.println(coll);} } 在JDK8.0时Collection接口有了removeIf 方法即可以根据条件删除。第18章中再讲 import org.junit.Test;import java.util.ArrayList; import java.util.Collection; import java.util.function.Predicate;public class TestCollectionRemoveIf {Testpublic void test01(){Collection coll new ArrayList();coll.add(小李广);coll.add(扫地僧);coll.add(石破天);coll.add(佛地魔);System.out.println(coll coll);coll.removeIf(new Predicate() {Overridepublic boolean test(Object o) {String str (String) o;return str.contains(地);}});System.out.println(删除包含\地\字的元素之后coll coll);} }3.3 foreach循环 foreach循环也称增强for循环是 JDK5.0 中定义的一个高级for循环专门用来遍历数组和集合的。 foreach循环的语法格式 for(元素的数据类型 局部变量 : Collection集合或数组){ //操作局部变量的输出操作 } //这里局部变量就是一个临时变量自己命名就可以举例 import org.junit.Test;import java.util.ArrayList; import java.util.Collection;public class TestForeach {Testpublic void test01(){Collection coll new ArrayList();coll.add(小李广);coll.add(扫地僧);coll.add(石破天);//foreach循环其实就是使用Iterator迭代器来完成元素的遍历的。for (Object o : coll) {System.out.println(o);}}Testpublic void test02(){int[] nums {1,2,3,4,5};for (int num : nums) {System.out.println(num);}System.out.println(-----------------);String[] names {张三,李四,王五};for (String name : names) {System.out.println(name);}} }对于集合的遍历增强for的内部原理其实是个Iterator迭代器。如下图。 它用于遍历Collection和数组。通常只进行遍历元素不要在遍历的过程中对集合元素进行增删操作。 练习判断输出结果为何 public class ForTest {public static void main(String[] args) {String[] str new String[5];for (String myStr : str) {myStr asdfghjkl;System.out.println(myStr);}for (int i 0; i str.length; i) {System.out.println(str[i]);}} }4. Collection子接口1List 4.1 List接口特点 鉴于Java中数组用来存储数据的局限性我们通常使用java.util.List替代数组 List集合类中元素有序、且可重复集合中的每个元素都有其对应的顺序索引。 举例List集合存储数据就像银行门口客服给每一个来办理业务的客户分配序号第一个来的是“张三”客服给他分配的是0第二个来的是“李四”客服给他分配的1以此类推最后一个序号应该是“总人数-1”。 JDK API中List接口的实现类常用的有ArrayList、LinkedList和Vector。 4.2 List接口方法 List除了从Collection集合继承的方法外List 集合里添加了一些根据索引来操作集合元素的方法。 插入元素 void add(int index, Object ele):在index位置插入ele元素boolean addAll(int index, Collection eles):从index位置开始将eles中的所有元素添加进来 获取元素 Object get(int index):获取指定index位置的元素List subList(int fromIndex, int toIndex):返回从fromIndex到toIndex位置的子集合 获取元素索引 int indexOf(Object obj):返回obj在集合中首次出现的位置int lastIndexOf(Object obj):返回obj在当前集合中末次出现的位置 删除和替换元素 Object remove(int index):移除指定index位置的元素并返回此元素 Object set(int index, Object ele):设置指定index位置的元素为ele 举例 import java.util.ArrayList; import java.util.List;public class TestListMethod {public static void main(String[] args) {// 创建List集合对象ListString list new ArrayListString();// 往 尾部添加 指定元素list.add(图图);list.add(小美);list.add(不高兴);System.out.println(list);// add(int index,String s) 往指定位置添加list.add(1,没头脑);System.out.println(list);// String remove(int index) 删除指定位置元素 返回被删除元素// 删除索引位置为2的元素System.out.println(删除索引位置为2的元素);System.out.println(list.remove(2));System.out.println(list);// String set(int index,String s)// 在指定位置 进行 元素替代改// 修改指定位置元素list.set(0, 三毛);System.out.println(list);// String get(int index) 获取指定位置元素// 跟size() 方法一起用 来 遍历的for(int i 0;ilist.size();i){System.out.println(list.get(i));}//还可以使用增强forfor (String string : list) {System.out.println(string);}} }注意在JavaSE中List名称的类型有两个一个是java.util.List集合接口一个是java.awt.List图形界面的组件别导错包了。 4.3 List接口主要实现类ArrayList ArrayList 是 List 接口的主要实现类 本质上ArrayList是对象引用的一个”变长”数组 Arrays.asList(…) 方法返回的 List 集合既不是 ArrayList 实例也不是 Vector 实例。 Arrays.asList(…) 返回值是一个固定长度的 List 集合 4.4 List的实现类之二LinkedList 对于频繁的插入或删除元素的操作建议使用LinkedList类效率较高。这是由底层采用链表双向链表结构存储数据决定的。 特有方法 void addFirst(Object obj)void addLast(Object obj)Object getFirst()Object getLast()Object removeFirst()Object removeLast() 4.5 List的实现类之三Vector Vector 是一个古老的集合JDK1.0就有了。大多数操作与ArrayList相同区别之处在于Vector是线程安全的。在各种List中最好把ArrayList作为默认选择。当插入、删除频繁时使用LinkedListVector总是比ArrayList慢所以尽量避免使用。特有方法 void addElement(Object obj)void insertElementAt(Object obj,int index)void setElementAt(Object obj,int index)void removeElement(Object obj)void removeAllElements() 5. Collection子接口2Set 5.1 Set接口概述 Set接口是Collection的子接口Set接口相较于Collection接口没有提供额外的方法Set 集合不允许包含相同的元素如果试把两个相同的元素加入同一个 Set 集合中则添加操作失败。Set集合支持的遍历方式和Collection集合一样foreach和Iterator。Set的常用实现类有HashSet、TreeSet、LinkedHashSet。 5.2 Set主要实现类HashSet 5.2.1 HashSet概述 HashSet 是 Set 接口的主要实现类大多数时候使用 Set 集合时都使用这个实现类。 HashSet 按 Hash 算法来存储集合中的元素因此具有很好的存储、查找、删除性能。 HashSet 具有以下特点 不能保证元素的排列顺序HashSet 不是线程安全的集合元素可以是 null HashSet 集合判断两个元素相等的标准两个对象通过 hashCode() 方法得到的哈希值相等并且两个对象的 equals() 方法返回值为true。 对于存放在Set容器中的对象对应的类一定要重写hashCode()和equals(Object obj)方法以实现对象相等规则。即“相等的对象必须具有相等的散列码”。 HashSet集合中元素的无序性不等同于随机性。这里的无序性与元素的添加位置有关。具体来说我们在添加每一个元素到数组中时具体的存储位置是由元素的hashCode()调用后返回的hash值决定的。导致在数组中每个元素不是依次紧密存放的表现出一定的无序性。 5.2.2 HashSet中添加元素的过程 第1步当向 HashSet 集合中存入一个元素时HashSet 会调用该对象的 hashCode() 方法得到该对象的 hashCode值然后根据 hashCode值通过某个散列函数决定该对象在 HashSet 底层数组中的存储位置。 第2步如果要在数组中存储的位置上没有元素则直接添加成功。 第3步如果要在数组中存储的位置上有元素则继续比较 如果两个元素的hashCode值不相等则添加成功如果两个元素的hashCode()值相等则会继续调用equals()方法 如果equals()方法结果为false则添加成功。如果equals()方法结果为true则添加失败。 第2步添加成功元素会保存在底层数组中。 第3步两种添加成功的操作由于该底层数组的位置已经有元素了则会通过链表的方式继续链接存储。 举例 import java.util.Objects;public class MyDate {private int year;private int month;private int day;public MyDate(int year, int month, int day) {this.year year;this.month month;this.day day;}Overridepublic boolean equals(Object o) {if (this o) return true;if (o null || getClass() ! o.getClass()) return false;MyDate myDate (MyDate) o;return year myDate.year month myDate.month day myDate.day;}Overridepublic int hashCode() {return Objects.hash(year, month, day);}Overridepublic String toString() {return MyDate{ year year , month month , day day };} }import org.junit.Test;import java.util.HashSet;public class TestHashSet {Testpublic void test01(){HashSet set new HashSet();set.add(张三);set.add(张三);set.add(李四);set.add(王五);set.add(王五);set.add(赵六);System.out.println(set set);//不允许重复无序}Testpublic void test02(){HashSet set new HashSet();set.add(new MyDate(2021,1,1));set.add(new MyDate(2021,1,1));set.add(new MyDate(2022,2,4));set.add(new MyDate(2022,2,4));System.out.println(set set);//不允许重复无序} }5.2.3 重写 hashCode() 方法的基本原则 在程序运行时同一个对象多次调用 hashCode() 方法应该返回相同的值。当两个对象的 equals() 方法比较返回 true 时这两个对象的 hashCode() 方法的返回值也应相等。对象中用作 equals() 方法比较的 Field都应该用来计算 hashCode 值。 注意如果两个元素的 equals() 方法返回 true但它们的 hashCode() 返回值不相等hashSet 将会把它们存储在不同的位置但依然可以添加成功。 5.2.4 重写equals()方法的基本原则 重写equals方法的时候一般都需要同时复写hashCode方法。通常参与计算hashCode的对象的属性也应该参与到equals()中进行计算。 推荐开发中直接调用Eclipse/IDEA里的快捷键自动重写equals()和hashCode()方法即可。 为什么用Eclipse/IDEA复写hashCode方法有31这个数字 首先选择系数的时候要选择尽量大的系数。因为如果计算出来的hash地址越大所谓的“冲突”就越少查找起来效率也会提高。减少冲突其次31只占用5bits,相乘造成数据溢出的概率较小。再次31可以 由i*31 (i5)-1来表示,现在很多虚拟机里面都有做相关优化。提高算法效率最后31是一个素数素数作用就是如果我用一个数字来乘以这个素数那么最终出来的结果只能被素数本身和被乘数还有1来整除(减少冲突)5.2.5 练习 **练习1**在List内去除重复数字值要求尽量简单 public static List duplicateList(List list) {HashSet set new HashSet();set.addAll(list);return new ArrayList(set); } public static void main(String[] args) {List list new ArrayList();list.add(new Integer(1));list.add(new Integer(2));list.add(new Integer(2));list.add(new Integer(4));list.add(new Integer(4));List list2 duplicateList(list);for (Object integer : list2) {System.out.println(integer);} } **练习2**获取随机数 编写一个程序获取10个1至20的随机数要求随机数不能重复。并把最终的随机数输出到控制台。 public class RandomValueTest {public static void main(String[] args) {HashSet hs new HashSet(); // 创建集合对象Random r new Random();while (hs.size() 10) {int num r.nextInt(20) 1; // 生成1到20的随机数hs.add(num);}for (Integer integer : hs) { // 遍历集合System.out.println(integer); // 打印每一个元素}} } **练习3**去重 使用Scanner从键盘读取一行输入去掉其中重复字符打印出不同的那些字符。比如aaaabbbcccddd public class DistinctTest {public static void main(String[] args) {Scanner sc new Scanner(System.in); // 创建键盘录入对象System.out.println(请输入一行字符串:);String line sc.nextLine(); // 将键盘录入的字符串存储在line中char[] arr line.toCharArray(); // 将字符串转换成字符数组HashSet hs new HashSet(); // 创建HashSet集合对象for (Object c : arr) { // 遍历字符数组hs.add(c); // 将字符数组中的字符添加到集合中}for (Object ch : hs) { // 遍历集合System.out.print(ch);}} } **练习4**面试题 HashSet set new HashSet(); Person p1 new Person(1001,AA); Person p2 new Person(1002,BB);set.add(p1); set.add(p2); p1.name CC; set.remove(p1); System.out.println(set);set.add(new Person(1001,CC)); System.out.println(set);set.add(new Person(1001,AA)); System.out.println(set);//其中Person类中重写了hashCode()和equal()方法 5.3 Set实现类之二LinkedHashSet LinkedHashSet 是 HashSet 的子类不允许集合元素重复。 LinkedHashSet 根据元素的 hashCode 值来决定元素的存储位置但它同时使用双向链表维护元素的次序这使得元素看起来是以添加顺序保存的。 LinkedHashSet插入性能略低于 HashSet但在迭代访问 Set 里的全部元素时有很好的性能。 举例 import org.junit.Test;import java.util.LinkedHashSet;public class TestLinkedHashSet {Testpublic void test01(){LinkedHashSet set new LinkedHashSet();set.add(张三);set.add(张三);set.add(李四);set.add(王五);set.add(王五);set.add(赵六);System.out.println(set set);//不允许重复体现添加顺序} }5.4 Set实现类之三TreeSet 5.4.1 TreeSet概述 TreeSet 是 SortedSet 接口的实现类TreeSet 可以按照添加的元素的指定的属性的大小顺序进行遍历。TreeSet底层使用红黑树结构存储数据新增的方法如下 (了解) Comparator comparator()Object first()Object last()Object lower(Object e)Object higher(Object e)SortedSet subSet(fromElement, toElement)SortedSet headSet(toElement)SortedSet tailSet(fromElement) TreeSet特点不允许重复、实现排序自然排序或定制排序TreeSet 两种排序方法自然排序和定制排序。默认情况下TreeSet 采用自然排序。 自然排序TreeSet 会调用集合元素的 compareTo(Object obj) 方法来比较元素之间的大小关系然后将集合元素按升序(默认情况)排列。 如果试图把一个对象添加到 TreeSet 时则该对象的类必须实现 Comparable 接口。实现 Comparable 的类必须实现 compareTo(Object obj) 方法两个对象即通过 compareTo(Object obj) 方法的返回值来比较大小。 定制排序如果元素所属的类没有实现Comparable接口或不希望按照升序(默认情况)的方式排列元素或希望按照其它属性大小进行排序则考虑使用定制排序。定制排序通过Comparator接口来实现。需要重写compare(T o1,T o2)方法。 利用int compare(T o1,T o2)方法比较o1和o2的大小如果方法返回正整数则表示o1大于o2如果返回0表示相等返回负整数表示o1小于o2。要实现定制排序需要将实现Comparator接口的实例作为形参传递给TreeSet的构造器。 因为只有相同类的两个实例才会比较大小所以向 TreeSet 中添加的应该是同一个类的对象。对于 TreeSet 集合而言它判断两个对象是否相等的唯一标准是两个对象通过 compareTo(Object obj) 或compare(Object o1,Object o2)方法比较返回值。返回值为0则认为两个对象相等。 5.4.2 举例 举例1 import org.junit.Test; import java.util.Iterator; import java.util.TreeSet;public class TreeSetTest {/** 自然排序针对String类的对象* */Testpublic void test1(){TreeSet set new TreeSet();set.add(MM);set.add(CC);set.add(AA);set.add(DD);set.add(ZZ);//set.add(123); //报ClassCastException的异常Iterator iterator set.iterator();while(iterator.hasNext()){System.out.println(iterator.next());}}/** 自然排序针对User类的对象* */Testpublic void test2(){TreeSet set new TreeSet();set.add(new User(Tom,12));set.add(new User(Rose,23));set.add(new User(Jerry,2));set.add(new User(Eric,18));set.add(new User(Tommy,44));set.add(new User(Jim,23));set.add(new User(Maria,18));//set.add(Tom);Iterator iterator set.iterator();while(iterator.hasNext()){System.out.println(iterator.next());}System.out.println(set.contains(new User(Jack, 23))); //true} }其中User类定义如下 public class User implements Comparable{String name;int age;public User() {}public User(String name, int age) {this.name name;this.age age;}Overridepublic String toString() {return User{ name name \ , age age };}/*举例按照age从小到大的顺序排列如果age相同则按照name从大到小的顺序排列* */public int compareTo(Object o) {if(this o){return 0;}if(o instanceof User){User user (User)o;int value this.age - user.age;if(value ! 0){return value;}return -this.name.compareTo(user.name);}throw new RuntimeException(输入的类型不匹配);} } 举例2 /** 定制排序* */ Test public void test3(){//按照User的姓名的从小到大的顺序排列Comparator comparator new Comparator() {Overridepublic int compare(Object o1, Object o2) {if(o1 instanceof User o2 instanceof User){User u1 (User)o1;User u2 (User)o2;return u1.name.compareTo(u2.name);}throw new RuntimeException(输入的类型不匹配);}};TreeSet set new TreeSet(comparator);set.add(new User(Tom,12));set.add(new User(Rose,23));set.add(new User(Jerry,2));set.add(new User(Eric,18));set.add(new User(Tommy,44));set.add(new User(Jim,23));set.add(new User(Maria,18));//set.add(new User(Maria,28));Iterator iterator set.iterator();while(iterator.hasNext()){System.out.println(iterator.next());} }5.4.3 练习 **练习1**在一个List集合中存储了多个无大小顺序并且有重复的字符串定义一个方法让其有序(从小到大排序)并且不能去除重复元素。 提示考查ArrayList、TreeSet public class SortTest {public static void main(String[] args) {ArrayList list new ArrayList();list.add(ccc);list.add(ccc);list.add(aaa);list.add(aaa);list.add(bbb);list.add(ddd);list.add(ddd);sort(list);System.out.println(list);}/** 对集合中的元素排序,并保留重复*/public static void sort(List list) {TreeSet ts new TreeSet(new Comparator() { Overridepublic int compare(Object o1, Object o2) { // 重写compare方法String s1 (String)o1;String s2 (String)o2;int num s1.compareTo(s2); // 比较内容return num 0 ? 1 : num; // 如果内容一样返回一个不为0的数字即可}});ts.addAll(list); // 将list集合中的所有元素添加到ts中list.clear(); // 清空listlist.addAll(ts); // 将ts中排序并保留重复的结果在添加到list中} } **练习2**TreeSet的自然排序和定制排序 定义一个Employee类。 该类包含private成员变量name,age,birthday其中 birthday 为 MyDate 类的对象 并为每一个属性定义 getter, setter 方法 并重写 toString 方法输出 name, age, birthday MyDate类包含: private成员变量year,month,day并为每一个属性定义 getter, setter 方法 创建该类的 5 个对象并把这些对象放入 TreeSet 集合中下一章TreeSet 需使用泛型来定义 分别按以下两种方式对集合中的元素进行排序并遍历输出 1). 使Employee 实现 Comparable 接口并按 name 排序 2). 创建 TreeSet 时传入 Comparator对象按生日日期的先后排序。 代码实现 public class MyDate implements Comparable{private int year;private int month;private int day;public MyDate() {}public MyDate(int year, int month, int day) {this.year year;this.month month;this.day day;}public int getYear() {return year;}public void setYear(int year) {this.year year;}public int getMonth() {return month;}public void setMonth(int month) {this.month month;}public int getDay() {return day;}public void setDay(int day) {this.day day;}Overridepublic String toString() { // return MyDate{ // year year // , month month // , day day // };return year 年 month 月 day 日;}Overridepublic int compareTo(Object o) {if(this o){return 0;}if(o instanceof MyDate){MyDate myDate (MyDate) o;int yearDistance this.getYear() - myDate.getYear();if(yearDistance ! 0){return yearDistance;}int monthDistance this.getMonth() - myDate.getMonth();if(monthDistance ! 0){return monthDistance;}return this.getDay() - myDate.getDay();}throw new RuntimeException(输入的类型不匹配);} }public class Employee implements Comparable{private String name;private int age;private MyDate birthday;public Employee() {}public Employee(String name, int age, MyDate birthday) {this.name name;this.age age;this.birthday birthday;}public String getName() {return name;}public void setName(String name) {this.name name;}public int getAge() {return age;}public void setAge(int age) {this.age age;}public MyDate getBirthday() {return birthday;}public void setBirthday(MyDate birthday) {this.birthday birthday;}Overridepublic String toString() {return Employee{ name name \ , age age \ , birthday birthday };}Overridepublic int compareTo(Object o) {if(o this){return 0;}if(o instanceof Employee){Employee emp (Employee) o;return this.name.compareTo(emp.name);}throw new RuntimeException(传入的类型不匹配);} }public class EmployeeTest {/*自然排序创建该类的 5 个对象并把这些对象放入 TreeSet 集合中* 需求1使Employee 实现 Comparable 接口并按 name 排序* */Testpublic void test1(){TreeSet set new TreeSet();Employee e1 new Employee(Tom,23,new MyDate(1999,7,9));Employee e2 new Employee(Rose,43,new MyDate(1999,7,19));Employee e3 new Employee(Jack,54,new MyDate(1998,12,21));Employee e4 new Employee(Jerry,12,new MyDate(2002,4,21));Employee e5 new Employee(Tony,22,new MyDate(2001,9,12));set.add(e1);set.add(e2);set.add(e3);set.add(e4);set.add(e5);//遍历Iterator iterator set.iterator();while(iterator.hasNext()){System.out.println(iterator.next());}}/** 定制排序* 创建 TreeSet 时传入 Comparator对象按生日日期的先后排序。* */Testpublic void test2(){Comparator comparator new Comparator() {Overridepublic int compare(Object o1, Object o2) {if(o1 instanceof Employee o2 instanceof Employee){Employee e1 (Employee) o1;Employee e2 (Employee) o2;//对比两个employee的生日的大小MyDate birth1 e1.getBirthday();MyDate birth2 e2.getBirthday();//方式1 // int yearDistance birth1.getYear() - birth2.getYear(); // if(yearDistance ! 0){ // return yearDistance; // } // int monthDistance birth1.getMonth() - birth2.getMonth(); // if(monthDistance ! 0){ // return monthDistance; // } // // return birth1.getDay() - birth2.getDay();//方式2return birth1.compareTo(birth2);}throw new RuntimeException(输入的类型不匹配);}};TreeSet set new TreeSet(comparator);Employee e1 new Employee(Tom,23,new MyDate(1999,7,9));Employee e2 new Employee(Rose,43,new MyDate(1999,7,19));Employee e3 new Employee(Jack,54,new MyDate(1998,12,21));Employee e4 new Employee(Jerry,12,new MyDate(2002,4,21));Employee e5 new Employee(Tony,22,new MyDate(2001,9,12));set.add(e1);set.add(e2);set.add(e3);set.add(e4);set.add(e5);//遍历Iterator iterator set.iterator();while(iterator.hasNext()){System.out.println(iterator.next());}} }6. Map接口 现实生活与开发中我们常会看到这样的一类集合用户ID与账户信息、学生姓名与考试成绩、IP地址与主机名等这种一一对应的关系就称作映射。Java提供了专门的集合框架用来存储这种映射关系的对象即java.util.Map接口。 6.1 Map接口概述 Map与Collection并列存在。用于保存具有映射关系的数据key-value Collection集合称为单列集合元素是孤立存在的理解为单身。Map集合称为双列集合元素是成对存在的(理解为夫妻)。 Map 中的 key 和 value 都可以是任何引用类型的数据。但常用String类作为Map的“键”。 Map接口的常用实现类HashMap、LinkedHashMap、TreeMap和Properties。其中HashMap是 Map 接口使用频率最高的实现类。 6.2 Map中key-value特点 这里主要以HashMap为例说明。HashMap中存储的key、value的特点如下 Map 中的 key用Set来存放不允许重复即同一个 Map 对象所对应的类须重写hashCode()和equals()方法 key 和 value 之间存在单向一对一关系即通过指定的 key 总能找到唯一的、确定的 value不同key对应的value可以重复。value所在的类要重写equals()方法。 key和value构成一个entry。所有的entry彼此之间是无序的、不可重复的。 6.2 Map接口的常用方法 添加、修改操作 Object put(Object key,Object value)将指定key-value添加到(或修改)当前map对象中void putAll(Map m):将m中的所有key-value对存放到当前map中 删除操作 Object remove(Object key)移除指定key的key-value对并返回valuevoid clear()清空当前map中的所有数据 元素查询的操作 Object get(Object key)获取指定key对应的valueboolean containsKey(Object key)是否包含指定的keyboolean containsValue(Object value)是否包含指定的valueint size()返回map中key-value对的个数boolean isEmpty()判断当前map是否为空boolean equals(Object obj)判断当前map和参数对象obj是否相等 元视图操作的方法 Set keySet()返回所有key构成的Set集合Collection values()返回所有value构成的Collection集合Set entrySet()返回所有key-value对构成的Set集合 举例 import java.util.HashMap;public class TestMapMethod {public static void main(String[] args) {//创建 map对象HashMap map new HashMap();//添加元素到集合map.put(黄晓明, 杨颖);map.put(李晨, 李小璐);map.put(李晨, 范冰冰);map.put(邓超, 孙俪);System.out.println(map);//删除指定的key-valueSystem.out.println(map.remove(黄晓明));System.out.println(map);//查询指定key对应的valueSystem.out.println(map.get(邓超));System.out.println(map.get(黄晓明));} }举例 public static void main(String[] args) {HashMap map new HashMap();map.put(许仙, 白娘子);map.put(董永, 七仙女);map.put(牛郎, 织女);map.put(许仙, 小青);System.out.println(所有的key:);Set keySet map.keySet();for (Object key : keySet) {System.out.println(key);}System.out.println(所有的value:);Collection values map.values();for (Object value : values) {System.out.println(value);}System.out.println(所有的映射关系:);Set entrySet map.entrySet();for (Object mapping : entrySet) {//System.out.println(entry);Map.Entry entry (Map.Entry) mapping;System.out.println(entry.getKey() - entry.getValue());} }6.3 Map的主要实现类HashMap 6.3.1 HashMap概述 HashMap是 Map 接口使用频率最高的实现类。HashMap是线程不安全的。允许添加 null 键和 null 值。存储数据采用的哈希表结构底层使用一维数组单向链表红黑树进行key-value数据的存储。与HashSet一样元素的存取顺序不能保证一致。HashMap 判断两个key相等的标准是两个 key 的hashCode值相等通过 equals() 方法返回 true。HashMap 判断两个value相等的标准是两个 value 通过 equals() 方法返回 true。 6.4 Map实现类之二LinkedHashMap LinkedHashMap 是 HashMap 的子类存储数据采用的哈希表结构链表结构在HashMap存储结构的基础上使用了一对双向链表来记录添加元素的先后顺序可以保证遍历元素时与添加的顺序一致。通过哈希表结构可以保证键的唯一、不重复需要键所在类重写hashCode()方法、equals()方法。 public class TestLinkedHashMap {public static void main(String[] args) {LinkedHashMap map new LinkedHashMap();map.put(王五, 13000.0);map.put(张三, 10000.0);//key相同新的value会覆盖原来的value//因为String重写了hashCode和equals方法map.put(张三, 12000.0);map.put(李四, 14000.0);//HashMap支持key和value为null值String name null;Double salary null;map.put(name, salary);Set entrySet map.entrySet();for (Object obj : entrySet) {Map.Entry entry (Map.Entry)obj;System.out.println(entry);}} }6.5 Map实现类之三TreeMap TreeMap存储 key-value 对时需要根据 key-value 对进行排序。TreeMap 可以保证所有的 key-value 对处于有序状态。TreeSet底层使用红黑树结构存储数据TreeMap 的 Key 的排序 自然排序TreeMap 的所有的 Key 必须实现 Comparable 接口而且所有的 Key 应该是同一个类的对象否则将会抛出 ClasssCastException定制排序创建 TreeMap 时构造器传入一个 Comparator 对象该对象负责对 TreeMap 中的所有 key 进行排序。此时不需要 Map 的 Key 实现 Comparable 接口 TreeMap判断两个key相等的标准两个key通过compareTo()方法或者compare()方法返回0。 public class TestTreeMap {/** 自然排序举例* */Testpublic void test1(){TreeMap map new TreeMap();map.put(CC,45);map.put(MM,78);map.put(DD,56);map.put(GG,89);map.put(JJ,99);Set entrySet map.entrySet();for(Object entry : entrySet){System.out.println(entry);}}/** 定制排序** */Testpublic void test2(){//按照User的姓名的从小到大的顺序排列TreeMap map new TreeMap(new Comparator() {Overridepublic int compare(Object o1, Object o2) {if(o1 instanceof User o2 instanceof User){User u1 (User)o1;User u2 (User)o2;return u1.name.compareTo(u2.name);}throw new RuntimeException(输入的类型不匹配);}});map.put(new User(Tom,12),67);map.put(new User(Rose,23),87);map.put(new User(Jerry,2),88);map.put(new User(Eric,18),45);map.put(new User(Tommy,44),77);map.put(new User(Jim,23),88);map.put(new User(Maria,18),34);Set entrySet map.entrySet();for(Object entry : entrySet){System.out.println(entry);}} }class User implements Comparable{String name;int age;public User(String name, int age) {this.name name;this.age age;}public User() {}Overridepublic String toString() {return User{ name name \ , age age };}/*举例按照age从小到大的顺序排列如果age相同则按照name从大到小的顺序排列* */Overridepublic int compareTo(Object o) {if(this o){return 0;}if(o instanceof User){User user (User)o;int value this.age - user.age;if(value ! 0){return value;}return -this.name.compareTo(user.name);}throw new RuntimeException(输入的类型不匹配);} }6.6 Map实现类之四Hashtable Hashtable是Map接口的古老实现类JDK1.0就提供了。不同于HashMapHashtable是线程安全的。Hashtable实现原理和HashMap相同功能相同。底层都使用哈希表结构数组单向链表查询速度快。与HashMap一样Hashtable 也不能保证其中 Key-Value 对的顺序Hashtable判断两个key相等、两个value相等的标准与HashMap一致。与HashMap不同Hashtable 不允许使用 null 作为 key 或 value。 面试题Hashtable和HashMap的区别 HashMap:底层是一个哈希表jdk7:数组链表;jdk8:数组链表红黑树,是一个线程不安全的集合,执行效率高 Hashtable:底层也是一个哈希表数组链表,是一个线程安全的集合,执行效率低HashMap集合:可以存储null的键、null的值 Hashtable集合,不能存储null的键、null的值Hashtable和Vector集合一样,在jdk1.2版本之后被更先进的集合(HashMap,ArrayList)取代了。所以HashMap是Map的主要实现类Hashtable是Map的古老实现类。Hashtable的子类Properties配置文件依然活跃在历史舞台 Properties集合是一个唯一和IO流相结合的集合6.7 Map实现类之五Properties Properties 类是 Hashtable 的子类该对象用于处理属性文件 由于属性文件里的 key、value 都是字符串类型所以 Properties 中要求 key 和 value 都是字符串类型 存取数据时建议使用setProperty(String key,String value)方法和getProperty(String key)方法 Test public void test01() {Properties properties System.getProperties();String fileEncoding properties.getProperty(file.encoding);//当前源文件字符编码System.out.println(fileEncoding fileEncoding); } Test public void test02() {Properties properties new Properties();properties.setProperty(user,songhk);properties.setProperty(password,123456);System.out.println(properties); }Test public void test03() throws IOException {Properties pros new Properties();pros.load(new FileInputStream(jdbc.properties));String user pros.getProperty(user);System.out.println(user); }7. Collections工具类 参考操作数组的工具类ArraysCollections 是一个操作 Set、List 和 Map 等集合的工具类。 7.1 常用方法 Collections 中提供了一系列静态的方法对集合元素进行排序、查询和修改等操作还提供了对集合对象设置不可变、对集合对象实现同步控制等方法均为static方法 排序操作 reverse(List)反转 List 中元素的顺序shuffle(List)对 List 集合元素进行随机排序sort(List)根据元素的自然顺序对指定 List 集合元素按升序排序sort(ListComparator)根据指定的 Comparator 产生的顺序对 List 集合元素进行排序swap(Listint int)将指定 list 集合中的 i 处元素和 j 处元素进行交换 查找 Object max(Collection)根据元素的自然顺序返回给定集合中的最大元素Object max(CollectionComparator)根据 Comparator 指定的顺序返回给定集合中的最大元素Object min(Collection)根据元素的自然顺序返回给定集合中的最小元素Object min(CollectionComparator)根据 Comparator 指定的顺序返回给定集合中的最小元素int binarySearch(List list,T key)在List集合中查找某个元素的下标但是List的元素必须是T或T的子类对象而且必须是可比较大小的即支持自然排序的。而且集合也事先必须是有序的否则结果不确定。int binarySearch(List list,T key,Comparator c)在List集合中查找某个元素的下标但是List的元素必须是T或T的子类对象而且集合也事先必须是按照c比较器规则进行排序过的否则结果不确定。int frequency(Collection cObject o)返回指定集合中指定元素的出现次数 复制、替换 void copy(List dest,List src)将src中的内容复制到dest中boolean replaceAll(List listObject oldValObject newVal)使用新值替换 List 对象的所有旧值提供了多个unmodifiableXxx()方法该方法返回指定 Xxx的不可修改的视图。 添加 boolean addAll(Collection c,T… elements)将所有指定元素添加到指定 collection 中。 同步 Collections 类中提供了多个 synchronizedXxx() 方法该方法可使将指定集合包装成线程同步的集合从而可以解决多线程并发访问集合时的线程安全问题 7.2 举例 import org.junit.Test;import java.text.Collator; import java.util.*;public class TestCollections {Testpublic void test01(){/*public static T boolean addAll(Collection? super T c,T... elements)将所有指定元素添加到指定 collection 中。Collection的集合的元素类型必须T类型*/CollectionObject coll new ArrayList();Collections.addAll(coll, hello,java);Collections.addAll(coll, 1,2,3,4);CollectionString coll2 new ArrayList();Collections.addAll(coll2, hello,java);//Collections.addAll(coll2, 1,2,3,4);//String和Integer之间没有父子类关系}Testpublic void test02(){ /** public static T extends Object Comparable? super T T max(Collection? extends T coll)* 在coll集合中找出最大的元素集合中的对象必须是T或T的子类对象而且支持自然排序 * * public static T T max(Collection? extends T coll,Comparator? super T comp) * 在coll集合中找出最大的元素集合中的对象必须是T或T的子类对象按照比较器comp找出最大者 * */ListMan list new ArrayList();list.add(new Man(张三,23));list.add(new Man(李四,24));list.add(new Man(王五,25));/** Man max Collections.max(list);//要求Man实现Comparable接口或者父类实现* System.out.println(max);*/Man max Collections.max(list, new ComparatorMan() {Overridepublic int compare(Man o1, Man o2) {return o2.getAge()-o2.getAge();}});System.out.println(max);}Testpublic void test03(){/** public static void reverse(List? list)* 反转指定列表List中元素的顺序。*/ListString list new ArrayList();Collections.addAll(list,hello,java,world);System.out.println(list);Collections.reverse(list);System.out.println(list);}Testpublic void test04(){/** public static void shuffle(List? list) * List 集合元素进行随机排序类似洗牌打乱顺序*/ListString list new ArrayList();Collections.addAll(list,hello,java,world);Collections.shuffle(list);System.out.println(list);}Testpublic void test05() {/** public static T extends Comparable? super T void sort(ListT list)* 根据元素的自然顺序对指定 List 集合元素按升序排序** public static T void sort(ListT list,Comparator? super T c)* 根据指定的 Comparator 产生的顺序对 List 集合元素进行排序*/ListMan list new ArrayList();list.add(new Man(张三,23));list.add(new Man(李四,24));list.add(new Man(王五,25));Collections.sort(list);System.out.println(list);Collections.sort(list, new ComparatorMan() {Overridepublic int compare(Man o1, Man o2) {return Collator.getInstance(Locale.CHINA).compare(o1.getName(),o2.getName());}});System.out.println(list);}Testpublic void test06(){/** public static void swap(List? list,int i,int j)* 将指定 list 集合中的 i 处元素和 j 处元素进行交换*/ListString list new ArrayList();Collections.addAll(list,hello,java,world);Collections.swap(list,0,2);System.out.println(list);}Testpublic void test07(){/** public static int frequency(Collection? c,Object o)* 返回指定集合中指定元素的出现次数*/ListString list new ArrayList();Collections.addAll(list,hello,java,world,hello,hello);int count Collections.frequency(list, hello);System.out.println(count count);}Testpublic void test08(){/** public static T void copy(List? super T dest,List? extends T src)* 将src中的内容复制到dest中*/ListInteger list new ArrayList();for(int i1; i5; i){//1-5list.add(i);}ListInteger list2 new ArrayList();for(int i11; i13; i){//11-13list2.add(i);}Collections.copy(list, list2);System.out.println(list);ListInteger list3 new ArrayList();for(int i11; i20; i){//11-20list3.add(i);}//java.lang.IndexOutOfBoundsException: Source does not fit in dest//Collections.copy(list, list3);//System.out.println(list);}Testpublic void test09(){/** public static T boolean replaceAll(ListT listT oldValT newVal)* 使用新值替换 List 对象的所有旧值*/ListString list new ArrayList();Collections.addAll(list,hello,java,world,hello,hello);Collections.replaceAll(list, hello,song);System.out.println(list);} }
http://www.ho-use.cn/article/10817108.html

相关文章:

  • 谷歌认证合作伙伴网站建设东莞企业建站程序
  • 重庆微信网站建设多少钱音乐网站制作课程报告
  • 山东网站建设运行工资网站建设买了服务器后怎么做
  • 网站布局的三种基本方法网站引导页动态效果怎么做的
  • 建设公司网站法律声明网站正在建设中怎么办
  • 刚成立公司如何做网站做网站可以用电脑当服务器吗
  • 酒店 公司 安徽 网站建设企业网络营销分析
  • 阿里云服务器做网站怎样制作自己的app
  • 大型门户网站核心技术网站建设哪家合适
  • 专题页网站wordpress展开 折叠功能
  • 泉州网站建设哪里优惠首钢建设一公司网站
  • 福田网站建设公司哪家性价比高网站建设知识点的总结
  • 工信部网站icp备案号学校网站建设报价单
  • 做哪种类型网站赚钱时尚女装网站模版
  • 哪家网站制作 优帮云中国网站建设公司百强
  • 网站建设科技有限公司住总集团公司宣传册设计样本
  • python3 网站开发网站框架包括哪些
  • 怎么做单页网站导航企业网站项目流程
  • 经销做网站都有什么好处江苏省网架公司
  • 金华网站制作营销移动云服务器租用
  • 怎么查询网站后台地址旅游网站建设意义
  • 怎样注册网站免费的吗新注册公司电话号码查询
  • 朝阳建筑工程建设网站曲阜人网站
  • cn体育门户网站源码中国十大购物网站排行榜
  • 在线做图片软件广东专业网站优化公司
  • wordpress 加密文章万荣网站seo
  • 站长友情链接平台商业网站运营成本
  • 做酒招代理的网站page list wordpress
  • dw如何用表格做网站阿里云学生服务器购买
  • 有哪些免费的ppt模板下载网站wordpress是英文的怎么办