JSON : Array & Compare

JSON : Array & Compare

I have a set of JSON array :

I have a set of JSON array :

listSession: [h0y78u93, h0y78u93, h0y78u93, h0y78u93, h0y78u93, 9i88u93, 9i88u93, 9i88u93, 9i88u93, 9i88u93]

I've created the array using the below code:

ArrayList<String> listSession = new ArrayList<String>(); 
            for(int u=1; u < k+1; u++) {
                String str = Integer.toString(u);

            JSONArray arrTime=(JSONArray)mergedJSON2.get(str);
            JSONObject objSession;
            for (Object ro : arrTime) {

                objSession = (JSONObject) ro;
                sessionName = String.valueOf(objSession.get("sessionID"));


May I get your advice or opinion on how am I going to compare the value from each of the attributes in the list. If it is the same, I should it as ONE. Meaning from the above sample, the count should be only TWO instead of TEN.

Thank You.

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Introduction to JSON - Java

Learn the fundamentals of parsing and manipulating JSON data with the JSON-Java library.

Understanding Arrays in Java

An array is a group of like-typed variables that are referred to by a common name.Arrays in Java work differently than they do in C/C++. Following are some important point about Java arrays.

A Complete Java Array Tutorial

In the article, we learn about Array, features of Array, Shortcomings of Array, Types of Arrays, Array Methods and how to use the Array Class and methods using Java.