果然做技术的就不能放下技术,学习能力再强,基本功不扎实,就得不到展示能力的机会。
或者,基本功,才是最基本的能力。
Java:
Set,接口,用于描述集合这种数据结构,集合的特点是不存在重复的元素。最常被使用的是测试归属性(存在性)。
HashSet,一种Set的实现,使用了Hash技术以提升查找的性能。
简单的样例代码:
Set<Integer> set = new HashSet<Integer>();
重要方法:
boolean add(T o);
boolean addAll(Collection<? extends T> c);
void clear();
boolean contains(Object o);
boolean contansAll(Collection<? extends T> c);
boolean remove(T o);
Map,接口,用于描述两类对象的映射关系,即键值对。Map的键不存在重复值。
HashMap,一种Map的实现,使用了Hash技术以提升查找性能。
TreeMap,另一种Map的实现,使用了红黑树排序以保证元素的有序性。
Map<K,V> map = new HashMap<K,V>();
V get(Object K);
V put(K key,V value);
V remove(Object key);
Set<K> keySet();
boolean containsKey(Object key);
boolean containsValue(Object value):
Runtime.getRuntime().addShutDownHook(Thread hook);
Runtime.getRuntime().removeShutDownHook(Thread hook);
Runtime.getRuntime().exec(String command);
Scanner scanner = new Scanner(InputStream in);
PrintWriter printWriter = new PrintWriter(OutputStream out);
ServerSocket serverSocket = new ServerSocket(int port);
Socket accept();