BeginnersBook

  • Home
  • Java
    • Java OOPs
    • Java Collections
    • Java Examples
  • C
    • C Examples
  • C++
    • C++ Examples
  • DBMS
  • Computer Network
  • Python
    • Python Examples
  • More…
    • jQuery
    • Kotlin
    • WordPress
    • SEO
    • JSON
    • JSP
    • JSTL
    • Servlet
    • MongoDB
    • XML
    • Perl

Archives for 2014

Convert HashSet to a List/ArrayList

Last Updated: September 11, 2022 by Chaitanya Singh | Filed Under: java

In this tutorial we will be learning how to convert a HashSet to a List (ArrayList). Program Here we have a HashSet of String elements… [Read More]

Tags: Collections, Java-ArrayList, Java-HashSet

Delete all the elements from HashSet

Last Updated: September 11, 2022 by Chaitanya Singh | Filed Under: java

Here we are gonna see how to remove all the elements of HashSet in one go. We can do so by calling clear() method of… [Read More]

Tags: Collections, Java-HashSet

How to copy one Set to another Set

Last Updated: September 11, 2022 by Chaitanya Singh | Filed Under: java

In this article we are gonna see an example program to copy one Set to another Set. Example In this example we are copying one… [Read More]

Tags: Collections, Java-Set

How to Iterate over a Set/HashSet

Last Updated: September 11, 2022 by Chaitanya Singh | Filed Under: java

There are following two ways to iterate through HashSet: 1) Using Iterator 2) Without using Iterator Example 1: Using Iterator import java.util.HashSet; import java.util.Iterator; class… [Read More]

Tags: Collections, Java-HashSet, Java-Set

Difference between String and StringBuffer

Last Updated: June 9, 2024 by Chaitanya Singh | Filed Under: java

In this article, we will discuss the difference between String and StringBuffer. Both of these classes used to handle sequence of characters. However they are… [Read More]

Tags: Java-Strings, StringBuffer

Difference between StringBuilder and StringBuffer

Last Updated: September 11, 2022 by Chaitanya Singh | Filed Under: java

In this article we are gonna discuss the differences between StringBuilder and StringBuffer. Before discussing the differences, lets have a look at what java documentation… [Read More]

Tags: Java-Strings

Java StringBuffer substring()

Last Updated: October 9, 2022 by Chaitanya Singh | Filed Under: java

In this tutorial, we will discuss the Java StringBuffer substring() method with the help of examples. The syntax of substring() method is: sb.substring(4) //substring starting… [Read More]

Tags: StringBuffer

Java StringBuffer replace()

Last Updated: October 9, 2022 by Chaitanya Singh | Filed Under: java

In this tutorial, we will discuss Java StringBuffer replace() method with the help of examples. Syntax of replace() method: //replace substring from index 4 to… [Read More]

Tags: StringBuffer

StringBuilder append() null values as “null” String

Last Updated: October 6, 2022 by Chaitanya Singh | Filed Under: java

While working with StringBuilder you may have come across a strange behaviour of append() method for null values. If you append a null value to… [Read More]

Tags: Java-StringBuilder

How to append a newline to StringBuilder

Last Updated: October 6, 2022 by Chaitanya Singh | Filed Under: java

There are following two ways to append a new Line to a StringBuilder object:1) StringBuilder.append(“\n”);2) StringBuilder.append(System.getProperty(“line.separator”)); Example In this example we have a StringBuilder object… [Read More]

Tags: Java-StringBuilder

Java – Get Set view of Keys from HashMap

Last Updated: September 11, 2022 by Chaitanya Singh | Filed Under: java

Description Program to get the Set of keys from HashMap. Example import java.util.Iterator; import java.util.HashMap; import java.util.Set; class HashMapExample{ public static void main(String args[]) {… [Read More]

Tags: Collections, Java-HashMap

How to check if a HashMap is empty or not?

Last Updated: September 11, 2022 by Chaitanya Singh | Filed Under: java

Description Program to check if a HashMap is empty or not. We are using isEmpty() method of HashMap class to perform this check. Program import… [Read More]

Tags: Collections, Java-HashMap

Clone a HashMap in Java

Last Updated: September 11, 2022 by Chaitanya Singh | Filed Under: java

Description A program to clone a HashMap. We will be using following method of HashMap class to perform cloning. public Object clone(): Returns a shallow… [Read More]

Tags: Collections, Java-HashMap

Java – LinkedList peek(), peekFirst() and peekLast() methods

Last Updated: September 11, 2022 by Chaitanya Singh | Filed Under: java

Description public E peek(): Retrieves, but does not remove, the head (first element) of this list. public E peekFirst(): Retrieves, but does not remove, the… [Read More]

Tags: Collections, Java-LinkedList

Java – LinkedList poll(), pollFirst() and pollLast() methods

Last Updated: September 11, 2022 by Chaitanya Singh | Filed Under: java

Description Example Programs for poll(), pollFirst() and pollLast() methods of LinkedList class. LinkedList.poll() Retrieves and removes the head (first element) of this list. import java.util.LinkedList;… [Read More]

Tags: Collections, Java-LinkedList

  • « Previous Page
  • 1
  • 2
  • 3
  • 4
  • …
  • 16
  • Next Page »

Java Tutorial

Java Introduction

  • Java Index
  • Java Introduction
  • History of Java
  • Features of Java
  • C++ vs Java
  • JDK vs JRE vs JVM
  • JVM - Java Virtual Machine
  • First Java Program
  • Variables
  • Data Types
  • Operators

Java Flow Control

  • Java If-else
  • Java Switch-Case
  • Java For loop
  • Java while loop
  • Java do-while loop
  • Continue statement
  • break statement

Java Arrays

  • Java Arrays

OOPs Concepts

  • OOPs Concepts
  • Constructor
  • Java String
  • Static keyword
  • Inheritance
  • Types of inheritance
  • Aggregation
  • Association
  • Super Keyword
  • Method overloading
  • Method overriding
  • Overloading vs Overriding
  • Polymorphism
  • Types of polymorphism
  • Static and dynamic binding
  • Abstract class and methods
  • Interface
  • Abstract class vs interface
  • Encapsulation
  • Packages
  • Access modifiers
  • Garbage Collection
  • Inner classes
  • Static import
  • Static constructor

Java Exception Handling

  • Exception handling
  • Java try-catch
  • Java throw
  • Java throws
  • Checked and Unchecked Exceptions
  • Jav try catch finally
  • Exception Examples
  • Exception Propagation

Collections Framework

  • Collections in Java
  • Java ArrayList
  • Java LinkedList
  • Java Vector
  • Java HashSet
  • Java LinkedHashSet
  • Java TreeSet
  • Java HashMap
  • Java TreeMap
  • Java LinkedHashMap
  • Java Queue
  • Java PriorityQueue
  • Java Deque
  • Comparable interface
  • Comparator interface
  • Collections Interview Questions

MORE ...

  • Java Scanner Class
  • Java 8 Features
  • Java 9 Features
  • Java Conversion
  • Java Date
  • Java Multithreading
  • Java I/O
  • Java Serialization
  • Java Regex
  • Java AWT
  • Java Swing
  • Java Enum
  • Java Annotations
  • Java main method
  • Java Interview Q

Copyright © 2012 – 2025 BeginnersBook . Privacy Policy . Sitemap