Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 JAVA


  Why exception would be thrown when deleting element while looping through HashMap in Java

HashMap and other Collection types are frequently used in Java application programming. This post will explain why exception would be thrown when deleting element with Map.remove() while looping through a Map using Iterator. This issue would also occur to other Collection types such as Set, List.Below is a sample code snippet demonstrating the exception thrown.Map<String,String> map = Collections.synchronizedMap(new TreeMap<String,String>()); map.put("key1","value1");map.put("key2","value2");map.put("key3","value3"); Set<Entry<String,String>> entries = map.entrySet(); I...

3,387 0       JAVA HASHMAP CONCURRENTMODIFICATIONEXCEPTION


  Java Concurrency Basics: CountDownLatch and CyclicBarrier

CountDownLatchCountDownLatch can be used in synchronizing behavior among threads, it makes one or more threads wait for some actions in other threads to be completed. It has a property count which defines how many countDown() need to be called before other threads which called await() to be waked up. When a thread calls CountDownLatch.await(), the thread will be blocked until the value of count becomes 0. The initial value of count can be specified when creating the CountDownLatch instance. Every time when CountDownLatch.countDown() is called, the value of count will decrease by 1 until t...

6,439 0       JAVA CONCURRENCY JAVA COUNTDOWNLATCH CYCLICBARRIER


  Stream API in Java 8

OverviewIn this lesson on Stream API in Java, we will study how we can put Streams to use to write efficient and much more maintainable code. We will also write code with and without Streams so that we are able to compare the two versions.Before doing all this, we must know how to create a Stream and process it and that is what we will get started with.Introduction to StreamsWe will be starting with creating Streams. Let us get started with the Stream<T> API which enables us to play with Stream processing.Creating StreamsStreams can be created from any source like a Collection or an arra...

3,696 0       DEVELOPMENT TEAM JAVA 8 STREAM API


  What will the value of Integer.valueOf(127) == Integer.valueOf(127) be in Java?

Do you really understand how Java does the integer comparison? OK, ignore the statements in the post title. What we are interested in is another set of comparison statements. Let's first see below code snippet.public class IntegerComparison { public static void main(String[] args) { Integer a = 127, b = 127; Integer c = 128, d = 128; System.out.println(a == b); System.out.println(c == d); }}What do you think the output will be? Are they both displaying true? You will find out the answer after reading through how Java optimizes some of the integer comparison logic.First, you need to un...

11,107 3       JAVA == EQUALSTO


  Java Then, Java Now - Looking at the evolution of Java from EE7 to EE9

Java, the programming language developed at Sun Microsystems in the 90s and later acquired by Oracle, is the most common programming environment used today, by developers across the globe. With the diversification of applicability that accompanied the technological boom, Java updates now come as Standard Editions (SE), Enterprise Edition (EE) and Micro Edition (ME). The Java SE contains the core programming logic and platform, used for relatively smaller-scale tasks and academic purposes. Java EE is used by Java Development companies for large-scale projects. It contains additional libraries w...

2,567 0       JAVA DEVELOPMENT COMPANY


  The latest on Java-on-Java: the Oracle experiment that is gaining momentum

What is Project Metropolis?The not so hush-hush Project Metropolis is all set to implement Java on itself – popularly known in the developer community as Java-on-Java. Oracle has released updates on its progress, and they are very encouraging.The project will focus on building a JIT (just in time) compiler that is written in Java. It is being touted as the experimental clone of JDK (Java Development Kit) 10. Work on ‘ahead of time’ compiling and Graal compiler is also in progress. This will take a significantly longer time to implement, but is a necessary factor to incre...

4,159 0       HIRE JAVA DEVELOPERS


  Benefits and Drawback of a Layered Architecture

Most enterprises today are application centric. But the problem with the application is that their database schemas, user interfaces, programming interfaces and object models are tightly coupled and difficult to change. If you want to add a new field to a database table and you’re lucky, the change will reflect through the entire system. But often the change needs to be replicated manually across the entire system. And as applications are difficult to change, adding business rules or process to the application does not facilitate business agility. This is where layered architecture comes...

38,831 0       JAVA PROGRAMMING WEB DEVELOPMENT ENTERPRISE APPLICATION


  Difference between keystore and truststore

Security has become a vital concern in most of the online transactions nowadays. Lots of the world's most popular websites have adopted security protocols to transfer data, especially sensitive data. These security protocols including SSL/TLS which are using the private/public key exchange mechanism to establish secure connections. The private/public key cryptography is a really important invention and it allows data to be transferred securely and solves the big problem of transferring symmetric key securely over Internet at the same time. Because of this characteristic, private...

6,962 0       TRUSTSTORE KEYSTORE SSL SECURITY