美文网首页
Interface Set

Interface Set

作者: aliusa | 来源:发表于2018-02-03 16:52 被阅读0次

定义:A set is a data structure which does not allow duplicate elements.

Set继承了Collection接口.没有新增方法.

实现要求,如果集合里面已经包含该元素则添加不成功

public boolean add(E object);

实现要求,只添加this集合里面没有的元素,如果参数collection里面有的元素在this集合里面已经有了就不添加此元素,继续下一个,只要有一个元素添加成功就返回true.

public boolean addAll(Collection collection);

相关文章

网友评论

      本文标题:Interface Set

      本文链接:https://www.haomeiwen.com/subject/fkbuzxtx.html