1. Common methods in the Object class:
protected Object clone() creates and returns a copy of this object.
boolean equals(Object obj) indicates whether another object is "equal" to this object.
protected void finalize() This method is called by the object's garbage collector when the garbage collector determines that no more references to the object exist.
Class<?> getClass() returns the runtime class of this Object.
int hashCode() returns the hash code value of the object.
void notify() wakes up a single thread waiting on this object monitor.
void notifyAll() wakes up all threads waiting on this object monitor.
String toString() returns the string representation of the object.
void wait() causes the current thread to wait before other threads call this object's notify() method or notifyAll() method.
void wait(long timeout) causes the current thread to wait before another thread calls the notify() method or notifyAll() method of this object, or exceeds the specified amount of time.
void wait(long timeout, int nanos) causes the current thread to wait before other threads call the notify() method or notifyAll() method of this object, or other thread interrupts the current thread, or has exceeded a certain amount of actual time.
2. Common methods in the Iterator interface:
•a.boolean hasNext() determines whether there is a next element
•bE next() returns the next element
•c.void remove() deletes the last element
3. Common methods in the ListIterator interface:
•a.boolean hasNext() determines whether there is a next element
•bE next() returns the next element
•c.int nextIndex() Returns the subscript of the next element
•d.boolean hasPrevious(); Whether there is a previous element;
•eE previous();Returns the previous element;
•f.int previousIndex(); returns the subscript of the previous element;
•g.void set(E e); sets the element.
•h.void add(E e);Add element.
4. Methods in the Collection class:
•a.boolean add(E e) Ensure that this collection contains the specified element.
•b.boolean addAll(Collection<? extends E> c) Adds all elements in the specified collection to this collection (optional action).
•c.void clear() removes all elements in this collection (optional operation).
•d.boolean equals(Object o) compares whether this collection is equal to the specified object.
•e.boolean isEmpty() This returns true if this collection does not contain elements.
•f. Iterator<E> iterator() returns an iterator that iterates on the element of this collection.
•g.boolean remove(Object o) Removes a single instance of the specified element from this collection, if present.
•h.boolean removeAll(Collection<?> c) Removes all elements in this collection that are also included in the specified collection.
•i.int size() returns the number of elements in this collection.
•j.Object[] toArray() Returns an array containing all elements in this collection.
•k.<T> T[] toArray(T[] a) returns an array containing all elements in this collection; the runtime type of the return array is the same as the runtime type of the specified array.
5.Map interface
•a.int size() The number of key-value pairs contained in the Map;
•b.boolean isEmpty()Map is there any elements;
•c.boolean containsKey(Object key) determines whether the key value pair contains the Key;
•d.boolean containsValue(Object value) determines whether the key-value pair contains value;
•eV get(Object key) gets the value of the Key; V is the type of value
•fV put(K key,V value) Put key-value pairs into the map.
•gV remove(Object key) deletes the key value.
•h.void putAll((Map<? extends K>,<? extends V> m) Puts all key-value pairs in another map.
•i.void clear(); clears all key-value pairs in the Map.
•j.Set<K> setKey(); returns a collection of keys.
•k.Collection<V> values(); returns a list of values.
•l.Set<Map.Entry<K,V>> entrySet(); Returns all key-value pairs in this Map as Entry entity.
•m.boolean equals(Object o); indicates whether an object is equal to this object;
•n.int hashCode(); returns the hash value of the object.
6. The String class is a final class that cannot be inherited.
char charAt(int index) Returns the index character in the string;
int length() Returns the length of the string;
int indexOf(String str) Returns the position where str appears for the first time in the string;
int indexOf(String str,int fromIndex) Returns the position where the string first appears from fromIndex;
boolean equalsIgnoreCase(String another) Compare whether a string is the same as another (ignoring upper and lower case);
String replace(char oldchar,char newChar) Replace oldChar character with newChar character in a string
boolean startsWith(String prefix) determines whether a string starts with a prefix string
boolean endsWith(String suffix) determines whether a string ends with a suffix string;
String toUpperCase() Returns a string in uppercase form of the string;
String toLowerCase() Returns a string in lowercase form of the string
String substring(int beginIndex) Returns the substring from the string starting from beginIndex to the end; String substring(int beginIndex,int endIndex) Returns the substring from the string starting from beginIndex to the endsIndex
String trim() Returns the string after removing the beginning and ending spaces of the string.
String[] split(String regex) Separates a string by the specified delimiter and returns the separated string array
int lastIndexOf(int ch) finds only the position of the last matching string.
int lastIndexOf(int ch, int fromIndex) Find only the location of the last matching string starting from fromIndex.
int lastIndexOf(String str) Find only the last matching string position.
int lastIndexOf(String str, int fromIndex) only finds the position of the last matching string starting from fromIndex.
int hashCode(): Returns the hash table code of the current character.
int indexOf(int ch): Find only the first matching character position.
int indexOf(int ch, int fromIndex) : Start from fromIndex to find the first matching character position.
int indexOf(String str): Find only the first matching string position.
int indexOf(String str, int fromIndex) : Start from fromIndex to find the first matching string position.
byte[] getBytes() : Convert the String object into a byte array.
void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin): This method copies the string into a character array. Among them, srcBegin is the start position of the copy, srcEnd is the end position of the copy, string value dst is the target character array, and dstBegin is the start position of the target character array.
The above brief analysis of Java classes and data structures is all the content I share with you. I hope you can give you a reference and I hope you can support Wulin.com more.