
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 33676 Articles for Programming

194 Views
The equals() method of the AbstractList class is used to compare the specified object with this list for equality. The value TRUE is returned if both the lists are same i.e the same size and elements.The syntax is as followspublic boolean equals(Object ob)Here, ob is the object is to be compared for equality. To work with the AbstractList class, import the following packageimport java.util.AbstractList;The following is an example to implement equals() method of the AbstractlList class in JavaExample Live Demoimport java.util.ArrayList; import java.util.AbstractList; public class Demo { public static void main(String[] args) { AbstractList myList = new ... Read More

92 Views
The limit() method of the DoubleStream class returns a stream consisting of the elements of this stream, truncated to be no longer than max in length. The max is a parameter of the limit() method.The syntax is as followsDoubleStream limit(long max)Here, max is the number of elements the stream should be limited to.To use the DoubleStream class in Java, import the following packageimport java.util.stream.DoubleStream;Create a DoubleStream and add elementsDoubleStream doubleStream = DoubleStream.of(10.8, 20.7, 25.8, 35.7, 78.2, 89.7, 67.8, 86.3);Now, to display n number of elements, set it as a parameter value for limit()doubleStream.limit(5)The following is an example to implement DoubleStream ... Read More

3K+ Views
The string library provides several functions to manipulate and match strings. In this article, we will see how the various functions of string library functions can be used to match strings in C++. String Matching in C++ String matching is a process of locating one string in another string. Meaning, here we will find the position of a string inside another string. The string matching functions will return the position of the first occurrence of the substring in the main string. If the substring is not found, it will return a special value such as -1 or string::npos. ... Read More

153 Views
The mapToInt() function of the DoubleStream class returns an IntStream consisting of the results of applying the given function to the elements of this stream.The syntax is as followsIntStream mapToInt(DoubleToIntFunction mapper)Here, mapper is a stateless function to apply to each element. The DoubleToIntFunction is a function that accepts a double-valued argument and produces an int-valued result.To use the DoubleStream class in Java, import the following packageimport java.util.stream.DoubleStream;The following is an example to implement DoubleStream mapToInt() method in JavaExample Live Demoimport java.util.stream.IntStream; import java.util.stream.DoubleStream; public class Demo { public static void main(String[] args) { DoubleStream doubleStream = DoubleStream.of(45.8, ... Read More

285 Views
The iterator() method of the IntStream class in Java is used to return an iterator for the elements of this stream.The syntax is as followsPrimitiveIterator.OfInt iterator()Here, PrimitiveIterator.OfInt is an Iterator specialized for int values. To work with the IntStream class in Java, import the following packageimport java.util.stream.IntStream;Create an IntStream and add some elementsIntStream intStream = IntStream.of(15, 40, 55, 70, 95, 120);To return an iterator for the stream elementsPrimitiveIterator.OfInt primIterator = intStream.iterator();The following is an example to implement IntStream iterator() method in JavaExample Live Demoimport java.util.*; import java.util.stream.IntStream; public class Demo { public static void main(String[] args) { ... Read More

131 Views
The listIterator() method of the CopyOnWriteArrayList class in Java is used to return a list iterator over the elements in this list.The syntax is as followspublic ListIterator listIterator()To work with CopyOnWriteArrayList class, you need to import the following packageimport java.util.concurrent.CopyOnWriteArrayList;The following is an example to implement CopyOnWriteArrayList class listIterator() method in JavaExample Live Demoimport java.util.Iterator; import java.util.concurrent.CopyOnWriteArrayList; public class Demo { public static void main(String[] args) { CopyOnWriteArrayList arrList = new CopyOnWriteArrayList(); arrList.add(30); arrList.add(40); arrList.add(60); arrList.add(70); arrList.add(90); arrList.add(100); ... Read More

480 Views
Here, we will see how to use Wagner and Fisher algorithm for string matching in C++. Using this algorithm, we can find how many minimum changes are required to match those strings. Wagner Fisher Algorithm Wagner Fisher is a dynamic programming algorithm that is used to find the minimum edit distance or levenshtein distance between two input strings. Levenshtein distance between two strings means the number of changes (ie, insertion, deletion or updation) required to convert one string into another. In simpler words, this algorithm will calculate a minimum number of changes required to convert ... Read More

1K+ Views
The IntStream max() method in the Java IntStream class is used to get the maximum element from the stream. It returns an OptionalInt describing the maximum element of this stream, or an empty optional if this stream is empty.The syntax is as followsOptionalInt max()Here, OptionalInt is a container object which may or may not contain an int value.Create an IntStream and add some elements in the streamIntStream intStream = IntStream.of(89, 45, 67, 12, 78, 99, 100);Now, get the maximum element from the streamOptionalInt res = intStream.max();The following is an example to implement IntStream max() method in Java. The isPresent() method ... Read More

112 Views
The accept() method of the LongStream.Builder class adds an element to the stream being built.The syntax is as followsvoid accept(long i)Here, i is the input.To use the LongStream.Builder class in Java, import the following packageimport java.util.stream.LongStream;Create a LongStreamLongStream.Builder builder = LongStream.builder();Add some elementsbuilder.accept(200L); builder.accept(600L); builder.accept(400L);The following is an example to implement LongStream.Builder accept() method in JavaExample Live Demoimport java.util.stream.LongStream; public class Demo { public static void main(String[] args) { LongStream.Builder builder = LongStream.builder(); builder.accept(200L); builder.accept(600L); builder.accept(400L); builder.accept(350L); builder.accept(900L); builder.accept(850L); ... Read More

5K+ Views
C++ provides multiple ways to concatenate strings. Macro string concatenation is one of such way. In this article, we will learn how to use C++ preprocessor macros to concatenate strings and tokens. Understanding Macros in C++ In C++, macros are small pieces of code that are defined using the preprocessor directive #define. Macros are generally used to define variables, constants, functions, and other code blocks. When the code is compiled, the preprocessor replaces every occurrence of the macro with its defined value before actual compilation begins. Let's see an example of a macro definition and its usage. // ... Read More