1. Trang chủ
  2. » Công Nghệ Thông Tin

Bài giảng cấu trúc dữ liệu chương 14 nguyễn xuân vinh

22 257 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 22
Dung lượng 379,35 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

For example, the set difference of s1 minus s2 is the set containing all of the elements found in s1 but not in s2...  Positional access — manipulates elements based on their numerical

Trang 1

[214441]

Trang 12

 clear — removes all elements from the Collection.

Trang 13

 For example, suppose that c is a Collection:

Object[] a = c.toArray();

String[] a = c.toArray(new String[0]);

Trang 15

public class FindDups {

public static void main(String[] args) {

Set<String> s = new HashSet<String>();

for (String a : args)

if (!s.add(a))

System.out.println( "Duplicate detected: " + a);

System.out.println(s.size() + " distinct words: " + s); }

Trang 16

 s1.removeAll(s2) — transforms s1 into the (asymmetric) set 

difference of s1 and s2. (For example, the set difference of s1 minus s2 is the set containing all of the elements found in s1 but not in s2.)

Trang 18

 Positional access — manipulates elements based on their 

numerical position in the list

 Search — searches for a specified object in the list and returns its numerical position

 Iteration — extends Iterator semantics to take advantage of the list's sequential nature

 Range-view — performs arbitrary range operations on the list

Trang 19

int indexOf(Object o);

int lastIndexOf(Object o);

Trang 20

public interface ListIterator<E> extends Iterator<E> { boolean hasNext();

void remove(); //optional

void set(E e); //optional

void add(E e); //optional

}

Trang 22

boolean containsKey(Object key);

boolean containsValue(Object value);

public Set<K> keySet();

public Collection<V> values();

public Set<Map.Entry<K,V>> entrySet();

public interface Entry {

Ngày đăng: 03/12/2015, 06:44

TỪ KHÓA LIÊN QUAN

🧩 Sản phẩm bạn có thể quan tâm