CORE API / CATATAN</>↗Core API10 Jul 2010
This example demonstrates how to convert a Vector object into an array. You can use the Vector.copyInto(Object[] array) method to create a copy of the Vector object in array form. package org.kodejava.util; import java.util.Vector; public class VectorToArray { public static void main(String[] args) { Vector<Integer> vector = new Vector<>(); vector.add(10); vector.add(20); vector.add(30); vector.add(40); vector.add(50); // […]
BASIC / CATATAN</>↗Basic06 Jul 2010
The signed shift right operator >> shifts a bit pattern to the right. 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 1000 bit pattern using the >> operator 2 position will produce a 0010 bit pattern. The signed shift […]
BASIC / CATATAN</>↗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 / CATATAN</>↗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 / CATATAN</>↗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 / CATATAN</>↗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"); […]