Arjun Thakur has Published 1025 Articles

Get Enumeration over ArrayList with Java Collections

Arjun Thakur

Arjun Thakur

Updated on 25-Jun-2020 14:36:46

599 Views

In order to get enumeration over ArrayList with Java Collections, we use the java.util.Collections.enumeration() method.Declaration −The java.util.Collections.enumeration() method is declared is as follows −public static Enumeration enumeration(Collection c)where c is the collection object for which an enumeration is returnedLet us see a program to get enumeration over ArrayList −Example Live ... Read More

Replace all occurrences of specified element of ArrayList with Java Collections

Arjun Thakur

Arjun Thakur

Updated on 25-Jun-2020 14:34:24

2K+ Views

In order to replace all occurrences of specified element of ArrayList with Java Collections, we use the Collections.replaceAll() method. This method returns true if list contains one or more elements e such that (oldVal==null ? e==null : oldVal.equals(e)).Declaration −The java.util.Collections.replaceAll() is declared as follows −public static boolean replaceAll(List list, ... Read More

Multithreading in Java

Arjun Thakur

Arjun Thakur

Updated on 25-Jun-2020 14:32:18

689 Views

Java is a multi-threaded programming language which means we can develop multi-threaded program using Java. A multi-threaded program contains two or more parts that can run concurrently and each part can handle a different task at the same time making optimal use of the available resources specially when your computer ... Read More

Lambda expression in Java 8

Arjun Thakur

Arjun Thakur

Updated on 25-Jun-2020 14:17:55

669 Views

Lambda expressions are introduced in Java 8 and are touted to be the biggest feature of Java 8. Lambda expression facilitates functional programming, and simplifies the development a lot.SyntaxA lambda expression is characterized by the following syntax.parameter -> expression bodyFollowing are the important characteristics of a lambda expression.Optional type declaration ... Read More

Random vs Secure Random numbers in Java

Arjun Thakur

Arjun Thakur

Updated on 25-Jun-2020 14:15:38

4K+ Views

Java provides two classes for having random numbers generation - SecureRandom.java and Random.java.The random numbers can be used generally for encryption key or session key or simply password on web server.SecureRandom is under java.security package while Random.java comes under java.util package.The basic and important difference between both is SecureRandom generate ... Read More

static Keyword in Java programming

Arjun Thakur

Arjun Thakur

Updated on 25-Jun-2020 14:12:49

385 Views

The Static ModifierStatic VariablesThe static keyword is used to create variables that will exist independently of any instances created for the class. Only one copy of the static variable exists regardless of the number of instances of the class.Static variables are also known as class variables. Local variables cannot be ... Read More

Primitive Wrapper Classes are Immutable in Java

Arjun Thakur

Arjun Thakur

Updated on 25-Jun-2020 14:06:49

2K+ Views

In Java Immutable class is a class which once created and it's contents can not be changed.On same concept Immutable objects are the objects whose state can not be changed once constructed.Wrapper classes are made to be immutable due to following advantages −Since the state of the immutable objects can ... Read More

The most Common POSIX System Calls in Python

Arjun Thakur

Arjun Thakur

Updated on 25-Jun-2020 14:04:38

923 Views

The posix module is works on the UNIX environment. It provides the Operating system functionality.We should not import this module directly. We can use the os module. The os module is acts as a superset of the posix module on UNIX. On non-Unix system the posix is not available, but ... Read More

Generate Random Long type numbers in Java

Arjun Thakur

Arjun Thakur

Updated on 25-Jun-2020 14:04:27

5K+ Views

In order to generate Random long type numbers in Java, we use the nextLong() method of the java.util.Random class. This returns the next random long value from the random generator sequence.Declaration − The java.util.Random.nextLong() method is declared as follows −public long nextLong()Let us see a program to generate random long ... Read More

Find the Package of an Object in Java

Arjun Thakur

Arjun Thakur

Updated on 25-Jun-2020 14:00:45

1K+ Views

The package for an object of a class can be obtained using the getPackage() method with the help of the class loader of the class. If there is no package object created by the class loader of the class, then null is returned.A program that demonstrates this is given as ... Read More

Advertisements