Description public E peek(): Retrieves, but does not remove, the head (first element) of this list. public E peekFirst(): Retrieves, but does not remove, the… [Read More]
Archives for 2014
Java – LinkedList poll(), pollFirst() and pollLast() methods
Description Example Programs for poll(), pollFirst() and pollLast() methods of LinkedList class. LinkedList.poll() Retrieves and removes the head (first element) of this list. import java.util.LinkedList;… [Read More]
LinkedList push() and pop() methods – Java
Description Programs to demonstrate push and pop operations on LinkedList. LinkedList.push(E e) public void push(E e): Inserts the element at the front of the list…. [Read More]
Adding element to front of LinkedList in Java
Description Program to add element to front(head) of LinkedList. Program import java.util.LinkedList; class LinkedListExample { public static void main(String[] args) { // create a LinkedList… [Read More]
Java – Get the index of last occurrence of an element in LinkedList
Description Program to find out the index of last occurrence of an element in LinkedList. Program import java.util.LinkedList; class LinkedListExample { public static void main(String[]… [Read More]
Iterate a LinkedList in reverse sequential order – java
Description Program to iterate a LinkedList in reverse order using descendingIterator() method of LinkedList class. Program import java.util.LinkedList; import java.util.Iterator; class LinkedListDemo { public static… [Read More]
Clone a generic LinkedList in Java
Example import java.util.LinkedList; class LinkedListClone { public static void main(String[] args) { // create a LinkedList LinkedList<String> list = new LinkedList<String>(); // Adding elements to… [Read More]
Adding an element to LinkedList using add(E e) method – Java
Description Program to add a new element to LinkedList using add(E e) method of LinkedList class. Example import java.util.LinkedList; class LinkedListAdd { public static void… [Read More]
Append all the elements of a List to LinkedList – Java
Description Program to add all the elements of a List to the LinkedList using addAll() method of LinkedList class. Example import java.util.ArrayList; import java.util.LinkedList; import… [Read More]
Get absolute value of float, int, double and long using Math.abs in Java
Description In this tutorial we are gonna see a program to find out the absolute values of float, int, double and long variables in java…. [Read More]
Boolean.hashCode() Method in Java
Description Program to get hash code for Boolean object. We are using hashCode() method of Boolean class for this purpose, it returns integer 1231 if… [Read More]
Compare boolean values in java – compareTo() Method
Description Program to compare boolean values. Example In this example we are going to see how to compare two boolean values by using compareTo() method… [Read More]
Cast Boolean Object to boolean in Java – booleanValue() Method
Description Program to convert Boolean object to boolean primitive in java Example class BooleanObjToBooleanPrim { public static void main(String[] args) { // Creating an object… [Read More]
Convert boolean Primitive to Boolean object in Java
Description Program to convert boolean primitive to Boolean object Example class BooleanPrimToBooleanObj { public static void main(String[] args) { boolean bvar = true; /* Method… [Read More]
Convert String to boolean primitive in Java: parseBoolean() method
Description How to convert String object to boolean primitive in Java. Example: Complete conversion code In this example we are converting string to boolean using… [Read More]
- « Previous Page
- 1
- 2
- 3
- 4
- 5
- …
- 16
- Next Page »