Java

“Core Java” is Sun’s term, used to refer to Java SE, the standard edition and a set of related technologies, like the Java VM, CORBA, etc. This is mostly to differentiate from others like Java ME or Java EE. “Core Java” is Oracle’s definition and refers to subset of Java SE technologies.

The Core Java technologies and application programming interfaces (APIs) are the foundation of the Java Platform, Standard Edition (Java SE). They are used in all classes of Java programming, from desktop applications to Java EE applications.

Related Tags

Tutorials

Java ArrayList spliterator() Example

Since Java 8, Spliterators are a special type of iterator that supports parallel iteration of portions of the source such as list, set, or array.

Java ArrayList replaceAll()

ArrayList replaceAll() transform each element in the list by applying a lambda expression or UnaryOperator implementation.

Java List retainAll()

In Java, the ArrayList.retainAll() retains only those elements in this list that are contained in the specified collection. Rest all elements are removed from the list. This method is exactly the opposite to removeAll() method. 1. Syntax The syntax to use the retainAll() method is: Method Argument – a collection …

Java ArrayList.listIterator()

Java ArrayList.listIterator() returns a bi-directional list iterator that iterates over the elements of the current list.

Java ArrayList forEach()

ArrayList forEach() method iterate the list and performs the argument action for each element of the list until all elements have been processed.

Java Tuple (with Examples)

A tuple is an immutable wrapper object that holds different pieces of information. Learn to create tuples using a custom Java class and Javatuple library.

Java ArrayList add() – Add a Single Element to List

The ArrayList.add() in Java adds a single element to the list, either at the end of the list or at the specified index position. Always use generics for compile-time type safety while adding the element to the arraylist. 1. ArrayList.add() Method The add() method first ensures that there is sufficient …

Java Vector vs ArrayList

In Java, ArrayList and Vector, both implement java.util.List interface and provide the capability to store and get objects within using simple API methods. Still, they are different in many aspects, and we need to understand both classes in detail to make a wise decision about when to use which class. …

Java ArrayList.toArray()

Learn to convert ArrayList to an array using toArray() method. The toArray() returns an array containing all of the elements in the list.

Java ArrayList.ensureCapacity()

Learn to use ArrayList ensureCapacity() method to increase the capacity of already initialized arraylist to a desired size. It improve performance of list.

Replace an Existing Item in ArrayList

Learn to update or replace an existing element in ArrayList with a new specified element or value, using set (int index, Object newItem) method. 1. Replacing an Existing Item To replace an existing item, we must find the item’s exact position (index) in the ArrayList. Once we have the index, …

Format a Phone Number with Regex in Java

Learn to format a specified string to a phone number pattern, which is ‘(123) 456-6789’. This conversion is generally required in applications where customer data has to be displayed, and phone number is part of this data. 1. Format String to ‘(###) ###-####‘ Pattern To format string to phone number …

How to Merge Two ArrayLists in Java

Learn how to merge two arraylists into a combined single arraylist in Java. Also learn to join arraylists without duplicates in the combined list.

How to Swap Two Elements in an ArrayList in Java

Learn to swap two specified elements in ArrayList in Java. We will use Collections.swap() method to swap two elements within a specified arraylist at specified indices. 1. Collections.swap() API The Collections.swap() method swaps the elements at the specified positions in the specified list. The index arguments must be a valid …

Synchronized ArrayList in Java

Learn to synchronize an ArrayList using either Collections.synchronizedList() or CopyOnWriteArrayList class with examples.

How to Compare Two Lists in Java

Learn to compare two arraylists in Java with List Items. Learn to test whether two arraylists are equal and then find different list items.

Java Arraylist.indexOf()

Learn to get the index of the first occurrence of an element in an arraylist in Java using ArrayList.indexOf() method with a simple example.

Java Arraylist.lastIndexOf()

Learn to get the index of last occurrence of an element in the arraylist in Java using Arraylist.lastIndexOf() method with a simple example.

Java ArrayList subList()

Learn to get a sublist from an existing ArrayList using ArrayList.subList() and modify the original list using the sublist view.

Add Multiple Elements to ArrayList in One Line

The Java ArrayList class is part of the Collection framework and is an implementation of a resizable array data structure. It automatically grows and shrinks when elements are added or removed in the runtime, whenever required, This Java tutorial discussed the different ways to add multiple items to an ArrayList …

Different Ways to Iterate an ArrayList

The Java iterate through ArrayList programs. Learn how to retrieve values from ArrayList in Java using for loop, while loop, iterator and stream api.

Initialize an ArrayList in Java

Java ArrayList can be initialized in one line using List.of(), and new ArrayList constructors. Learn to add elements one by one and in bulk.

Java String intern()

Learn to intern a string, and how the string literals differ from string objects. Java String.intern() is a native method and performs fast.

Java String contains()

Java String.contains() searches case-sensitive substring in a given string. It returns true if the substring is found, otherwise false.

Java String toLowerCase()

Java String toLowerCase() method transforms a String by converting all of its characters to lowercase, using the Locale rules if specified.

Java String toUpperCase()

Java String toUpperCase() transforms a string by replacing all lowercase characters to uppercase while leaving any characters already in uppercase.

Java String replaceAll()

The String.replaceAll(regex, replacement) in Java replaces all occurrences of a substring matching the specified regular expression with the replacement string. A similar method replace(substring, replacement) is used for matching the literal strings, while replaceAll() matches the regex. Note that in regular expressions, literal strings are also patterns, so replaceAll() will …

Java String replaceFirst()

Java String.replaceFirst() replaces the first occurrence of a substring found that matches the given argument substring (or regex).

Java String replace()

Java String replace() searches for a literal substring and replaces each occurrence with the replacement string beginning with index 0.

Java String concat()

Java String.concat() concatenates the argument string to the end of the current string and returns the combined string.

Java String substring()

Learn to find the substring of a string between the begin and end indices, and valid values for both indices with examples.

About Us

HowToDoInJava provides tutorials and how-to guides on Java and related technologies.

It also shares the best practices, algorithms & solutions and frequently asked interview questions.