Tuesday 12 January 2016

Classic Data Structures and Functions


1. ArrayList
  • void add(int index, Object element)
  • boolean add(Object o)
  • boolean addAll(Collection c)
  • boolean addAll(int index, Collection c)
  • void clear()
  • Object clone(): Returns a shallow copy of this ArrayList.
  • boolean contains(Object o)
  • void ensureCapacity(int minCapacity)
  • Object get(int index)
  • int indexOf(Object o)
  • int lastIndexOf(Object o)
  • Object remove(int index)
  • protected void removeRange(int fromIndex, int toIndex)
  • Object set(int index, Object element)
  • int size()
  • Object[] toArray()
  • Object[] toArray(Object[] a)
  • void trimToSize()
2. HashMap

  • void clear()
  • Object clone(): Returns a shallow copy of this HashMap instance.
  • boolean containsKey(Object key)
  • boolean containsValue(Object value)
  • Set entrySet()
  • Object get(Object key)
  • boolean isEmpty()
  • Set keySet()
  • Object put(Object key, Object value)
  • putAll(Map m)
  • Object remove(Object key)
  • int size()
  • Collection values()


2.2 HashSet
  • add()
  • clear()
  • clone()
  • contains()
  • isEmpty()
  • remove()
  • size()

3. Queue / LinkedList

  • boolean add(E e)
  • void add(int index, E element)
  • boolean addAll(Collection<? extends E> c)
  • void clear()
  • Object clone()
  • boolean contains(Object o)
  • E get(int index)
  • E peek()
  • E poll()
  • int size()
  • Object[] toArray()
  • public boolean isEmpty()
4. Stack
  • boolean empty()
  • Object peek( )
  • Object pop( )
  • Object push(Object element)
  • int search(Object element)
5. StringBuilder 

  • StringBuilder append(char c)
  • StringBuilder append(char[] str)
  • StringBuilder append(String s)
  • StringBuilder delete(int start, int end)
  • StringBuilder deleteCharAt(int index)
  • void setCharAt(int index, char c)
  • void insert(int index, char/string s)
  • StringBuilder reverse()
  • String toString()
  • int length()
6. String

  • char charAt(int index)
  • boolean endsWith(String suffix)
  • byte getBytes()
  • int hashCode()
  • int length()
  • boolean matches(String regex)
  • String replace(char oldChar, char newChar)
  • String replaceAll(String regex, String replacement)
  • String replaceFirst(String regex, String replacement)
  • String[] split(String regex)
  • boolean startsWith(String prefix)
  • String substring(int beginIndex)
  • String substring(int beginIndex, int endIndex)
  • char[] toCharArray()
  • String toLowerCase()
  • String toUpperCase()
  • String trim()
7. Heap / Priority Queue

  • boolean add(E e)
  • void clear()
  • boolean contains(Object o)
  • Iterator<E> iterator()
  • boolean offer(E e)
  • E peek()
  • E poll()
  • boolean remove(Object o)
  • int size()
  • Object[] toArray()
  • boolean isEmpty()

No comments:

Post a Comment