BASIC / NOTES</>↗Basic02 Jul 2010
The signed shift left operator << shifts a bit pattern to the left. This operator operates with two operand, the left-hand operand to be shifted and the right-hand operand tells how much position to shift. Shifting a 0010 bit pattern using the << operator 2 position will produce a 1000 bit pattern. The signed shift […]
BASIC / NOTES</>↗Basic02 Jul 2010
The unary bitwise complement operator (~) inverts a bit pattern; it can be applied to any of the integral types, making every 0 a 1 and every 1 a 0. For example, an integer contains 32 bits; applying this operator to a value whose bit pattern is 00000000000000000000000000001000 would change its pattern to 11111111111111111111111111110111. package […]
CORE API / NOTES</>↗Core API29 Jun 2010
This example shows you how to remove some elements from the Deque object. We can use the following methods for removing elements from Deque: remove(), remove(Object o), removeFirst(), removeLast(). package org.kodejava.util; import java.util.Deque; import java.util.LinkedList; public class RemoveDequeDemo { public static void main(String[] args) { Deque<String> deque = new LinkedList<>(); deque.add("A"); deque.add("B"); deque.add("C"); deque.add("D"); deque.add("E"); […]
CORE API / NOTES</>↗Core API29 Jun 2010
To add elements into a Deque object we can use the add(), addFirst() and addLast() method call. package org.kodejava.util; import java.util.Deque; import java.util.LinkedList; public class DequeAddElement { public static void main(String[] args) { // Create an instance of Deque using LinkedList class. Deque<String> deque = new LinkedList<>(); // Insert a word into the Deque deque.add("jumps"); […]
CORE API / NOTES</>↗Core API28 Jun 2010
The code snippet shows you how to create and instance of Hashtable that stores Integer values using a String keys. After that we iterate the elements of the Hashtable using the Enumeration interface. package org.kodejava.util; import java.util.Enumeration; import java.util.Hashtable; public class HashtableDemo { public static void main(String[] args) { // Creates an instance of Hashtable […]
CORE API / NOTES</>↗Core API23 Jun 2010
This example show you how to create a Deque using the ArrayDeque implementation. The ArrayDeque stores its elements using an array. If the number of elements exceeds the space in the array, a new array will be allocated, and all elements moved the new allocated array. In the code below we initiate the size of […]