Skip to content

Tech4Humans

Technology for All

  • General Tech
  • Tutorials
    • Eclipse Tutorials
  • Coding
  • Java
    • General Java
    • Java 11
    • Patterns
    • Constructors
    • Inheritance
    • Collections
      • ArrayList
      • HashMap
    • Sorting
  • Tech Memes
  • News
  • About
  • General Tech
  • Tutorials
    • Eclipse Tutorials
  • Coding
  • Java
    • General Java
    • Java 11
    • Patterns
    • Constructors
    • Inheritance
    • Collections
      • ArrayList
      • HashMap
    • Sorting
  • Tech Memes
  • News
  • About

Category: Collections

Collections / General Java

Comparator in Java

Ankitby AnkitMay 19, 2020May 19, 20200

Comparator Interface is a very useful interface which is used to sort the objects on some predefined conditions. Usually when we want to sort Integer type ArrayList then we use Collections.sort(arrayListName). This will sort the list of integers in ascending order. …

Read More
HashMap Iterator
HashMap

HashMap Iterator

Ankitby AnkitMay 15, 2020June 23, 20200

Iterator returned by entrySet() and keySet() methods can be used to iterate a HashMap in Java Let us look at the code for the iterator using both entrySet() and keySet() methods: Output 0

Read More
Iterate over Hashmap
HashMap

Iterate over Hashmap

Ankitby AnkitMay 15, 2020June 23, 20200

HashMap is a popular class of Collections framework which is used to store key value pair. There are 2 ways to iterate over the hashmap and access its keys and values. Let us look at these ways: Using entrySet() method entrySet() …

Read More
Duplicate Keys and Values in HashMap
HashMap

Duplicate Keys and Values in HashMap

Ankitby AnkitMay 15, 2020June 24, 20200

We are not allowed to enter duplicate keys in HashMap, but we can enter duplicate values in it. Please note here that, if we enter duplicate keys no error will be thrown but the latest key-value pair entered will replace the …

Read More
HashMap in Java
HashMap

HashMap in Java

Ankitby AnkitMay 15, 2020June 23, 20200

HashMap is one of the most used collections in Java. It is used to store key value pair. The size of HashMap increases as more key value pairs are added. Let us look at sample declaration of HashMap: HashMap<Integer,String> dummy = …

Read More
ArrayList Growth Factor
ArrayList

ArrayList Growth Factor

Ankitby AnkitMay 14, 2020June 13, 20200

ArrayList is a dynamic array which means the size of arraylist increases as the elements are added. The number by which the size is increased is known as Growth Factor. In ArrayList the Growth factor is 1.5, which means everytime the …

Read More
ArrayList Default Size
ArrayList

ArrayList Default Size

Ankitby AnkitMay 14, 2020June 13, 20200

Arraylist is a dynamic array whose size increases as we add more elements to it. When an ArrayList is created without specifying its size then the size of Arraylist initially is zero. But when we add the first element to the …

Read More
ArrayList in Java
ArrayList

ArrayList in Java

Ankitby AnkitMay 14, 2020June 13, 20200

ArrayList is one of the most used Collections in java. It is a dynamic array which means its size can increase automatically as more elements are added to it. Let us see how to create an arraylist: ArrayList<Integer> arrList = new …

Read More

Meme of the Day

Recent Posts

  • Create a Web project in Eclipse
  • Search text in multiple files in Eclipse
  • Search files in Eclipse Workspace
  • Import project in Eclipse
  • Debugging in Eclipse

Recent Comments

  • FunGuy on Change Screen Resolution in Windows 10

Recent Posts

  • Create a Web project in Eclipse
  • Search text in multiple files in Eclipse
  • Search files in Eclipse Workspace
  • Import project in Eclipse
  • Debugging in Eclipse

Recent Comments

  • FunGuy on Change Screen Resolution in Windows 10
Copyright © 2021 Tech4Humans. Powered by WordPress and Bam.