
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 9177 Articles for Object Oriented Programming

431 Views
Being a programmer we must have developed an application that performs CRUD operations. Here, the term CRUD means Create, Read, Update and delete. The collection on which these operations can be performed is called as modifiable collection. However, there is a way to make a collection unmodifiable so that one cannot make any changes to the original collection. Although we can't alter the elements, we can iterate over this collection. To iterate over unmodifiable collections in Java, we can use either the for-each loop or iterator(). Let's discuss it in detail. Iterate Over Unmodifiable Collection in Java As mentioned earlier, ... Read More

915 Views
In simple words, the iterable interface is a common interface that allows us to iterate over a collection of objects. It was first introduced with the release of JDK 1.5 and made available in 'java.lang' package. The Java Collection Framework extends this interface, hence all the classes available in this collection framework by default implement the iterable interface. In other words, the classes of collection framework such as ArrayList, TreeSet, TreeMap and HashMap are iterable. This article aims to explain the iterable interface of Java along with its use case. Iterable Interface in Java The only use case exhibited ... Read More

338 Views
In Java, interfaces serve two purposes pure abstraction and multiple inheritance. Generally, an interface consists of abstract methods and variables that define the behavior which a class can implement. If we create two interfaces that contain methods and variables with the same name, then interface naming conflicts may arise. However, it is not the only scenario that can cause this conflict, we are going to explore all the possible situations causing interface naming conflicts. Interface Naming Conflicts in Java Before heading to the interface naming conflicts, it is necessary to understand the abstract methods and how to create interfaces in ... Read More

628 Views
Array is a linear data structure that is used to store a group of elements with similar datatypes. It stores data in a sequential manner. Once we create an array we can't change its size i.e. it is of fixed length. There are various ways to create an array named 'a[]' of type integer including 'int[] a' and 'int a[]'. But, the question that pops up here is that is there any difference between these two syntaxes and which one is preferable. Stick with us till the end of this article to find out the answer to these questions. How ... Read More

1K+ Views
In Java, the streams allow us to perform the functional operations on the specified element. It simply channelizes the elements of source such as arrays, files and classes of collection framework, through various built-in methods to return the result. These built-in methods could be intermediate or terminal. In this article, we are going to explore some intermediate methods of Stream, such as map, filter, reduce, and collect. These methods help us to manipulate and process data. Intermediate Methods of Java Streams The methods of Java Streams are collectively called as a higher-order function, which further classified as − Intermediate ... Read More

2K+ Views
The smallest missing number is the smallest number that is missing from a stream of elements or in an Array. The stream may or may not contain continuous elements. If the stream is continuous then the smallest missing number is nothing but the Smallest Missing Number in a stream. In this section, we will discuss the various approaches to find a Smallest Missing Number in a stream of elements using Java programming language. Problem Statement Given a stream of integers find the smallest missing number from the stream. Input 1 arr=[1, 2, 3, 5, 6, 7, 8] Output 1 ... Read More

398 Views
Lost Number is the number which is missing from a continuous stream of elements or in an Array. In this section, we will discuss the various approaches to find a lost number in a stream of elements using java programming language. Example for a lost number in an array Lost number is a number which is missing from a continuous sequence of a numbers in an array. Example 1 Consider an array: arr=[1, 2, 3, 4, 5, 6, 8] In the above array ‘arr’, 7 is missing, so 7 is the lost number Example 2 Consider an array: arr=[1, ... Read More

942 Views
A TreeMap is a class provided by Java that implements Map Interface. It is a collection of key-value pairs and the key-value pairs in TreeMap are stored in sorted order based on key values. An Entry is defined as a key-value pair in a TreeMap. In this article, we will look in detail how to get TreeMap key-value pair or entry greater or less than the specified value. Methods Used Now, we will be looking into some of the inbuilt methods and their functionality of TreeMap which are used in this particular article. higherKey() − This method is ... Read More

387 Views
TreeSet is a class that implements Set interface in Java. In TreeSet the elements are stored in sorted order as it is implemented internally using a sorted balanced tree called as binary search tree. The elements in the TreeSet are stored in ascending order by default. Union of sets contains all the elements from both sets. Intersection of sets contain all the elements which are commonly present in both sets. In this section, we will be discussing about how to get the union and intersection of two TreeSet using Java. What are the Union and Intersection of Sets? ... Read More

4K+ Views
Size of a file is the amount of storage space occupied by that particular file on a particular storage device such as a hard drive. Size of a file is measured in terms of bytes. In this section, we will be discussing how to implement a java program to get the size of given file in bytes, kilobytes and megabytes. Understanding the file Sizes and Units of Measurement A byte is the smallest unit of digital information. One byte is equal to eight bits. 1 kilobyte (KB) = 1, 024 bytes 1 megabyte (MB) = ... Read More