Skip to content
sneppets

sneppets

  • Privacy
ArrayList removeAll() method

Java ArrayList removeAll() method not removing elements

May 26, 2019 Editorial StaffLeave a Comment on Java ArrayList removeAll() method not removing elements

This sneppet teaches you how to use ArrayList removeAll() method to remove elements from a ArrayList that are specified in a specific collection. Note, you have to override Object’s equals method to make this work. Example: ArrayList removeAll() method and… Read More!

Java ArrayList, java
check if string is not empty and not null

Java program to check if string is not empty and not null

May 26, 2019December 30, 2023 Editorial StaffLeave a Comment on Java program to check if string is not empty and not null

In this sneppet you will learn how to check if string is not empty and not null in Java. Note, a String with just whitespace is not considered as empty in Java. The following are the ways to test whether… Read More!

Java java, String

Running time in Big O notation for Java Arrays Algorithms

September 18, 2018December 8, 2018 Editorial StaffLeave a Comment on Running time in Big O notation for Java Arrays Algorithms

Big O notation is used to classify algorithms based on how the running time and space requirements grows as the input size grows. Big O notation is represented using upper case letter ‘O’ and the meaning of this notation is… Read More!

Java Algorithms, Datastructures, java

How to calculate running time of a java program

September 9, 2018December 8, 2018 Editorial StaffLeave a Comment on How to calculate running time of a java program

Use System.nanoTime(), it returns the current value of the running Java Virtual Machine’s ( Please check JVM internal details ) high-resolution time source in nanoseconds.

Java java

Binary Search

September 9, 2018March 11, 2020 Editorial StaffLeave a Comment on Binary Search

Binary search is also known as half-interval search or logarithmic search. It is a searching algorithm used to find the position of an element in the sorted array. The payoff for using a sorted array comes when we use a… Read More!

Algo, Java Algorithms, Datastructures, java

Posts navigation

Older posts
Newer posts
Copyright © 2018 Sneppets. All Rights Reserved