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
Programming Articles - Page 2755 of 3366
122 Views
The iterator() method of AbstractList class is used to return an iterator over the elements in this list in proper sequence.The syntax is as followspublic Iterator iterator()Here, the Iterator is an iterator over a collection. To work with the AbstractList class, import the following packageimport java.util.AbstractList;The following is an example to implement iterator() method of the AbstractlList class in JavaExample Live Demoimport java.util.ArrayList; import java.util.Iterator; import java.util.AbstractList; public class Demo { public static void main(String[] args) { AbstractList myList = new ArrayList(); myList.add(75); myList.add(100); myList.add(150); ... Read More
1K+ Views
The limit() method of the IntStream class is used to return a stream consisting of the elements of this stream, truncated to be no longer than maxSize in length. Here, maxSize is the parameter.The syntax is as followsIntStream limit(long maxSize)Here, the maxSize parameter is the count of elements the stream is limited to.At first, an IntStream is created with the range() method to set a sequential order of elementsIntStream intStream = IntStream.range(20, 40);Now, use the limit() method, whose parameter is the maxSize i.e. the count of elements the stream is limited tointStream.limit(8)The following is an example to implement IntStream limit() ... Read More
155 Views
The remove() method of the ArrayBlockingQueue class in Java is used to remove a single instance of the specified element from this queue.The syntax is as followsboolean remove(Object ele)Here, ele is the element to be removed from the queue. To work with ArrayBlockingQueue class, you need to import the following packageimport java.util.concurrent.ArrayBlockingQueue;The following is an example to implement remove() method of Java ArrayBlockingQueue classExample Live Demoimport java.util.ArrayList; import java.util.Iterator; import java.util.concurrent.ArrayBlockingQueue; public class Demo { public static void main(String[] args) throws InterruptedException { ArrayBlockingQueue q = new ArrayBlockingQueue(10); q.add(120); q.add(10); ... Read More
419 Views
The codePoint() method is used to display a stream of code point values from the given sequence.The syntax is as followsIntStream codePoints()To work with Java IntStream class, you need to import the following packageimport java.util.stream.IntStream;Here is our stringString myStr = "Example!";Now, get the code point valuesIntStream intStream = myStr.codePoints();The following is an example to implement codePoints() method in Java IntStreamExample Live Demoimport java.util.stream.IntStream; public class Demo { public static void main(String args[]) { String myStr = "Example!"; IntStream intStream = myStr.codePoints(); System.out.println("The following is the list of ASCII Values for the ... Read More
16K+ Views
Here in this program we will see how to iterate through each characters of a string in C++. To loop on each character, we can use loops starting from 0 to (string length – 1). For accessing the character we can either use subscript operator "[ ]" or at() function of string object. Input: A string "Hello World" Output: "Hello World" Algorithm Step 1: Get the string Step 2: Use R before string to make it raw string Step 3: End Example Code #include using namespace std; int main() { string my_str = "Hello World"; for(int i = 0; i
116 Views
The anyMatch() method of the DoubleStream class returns whether any elements of this stream match the provided predicate.The syntax is as followsboolean anyMatch(DoublePredicate predicate)Here, the parameter predicate is a stateless predicate to apply to elements of this stream. The DoublePredicate here is a predicate of one double-valued argument.To use the DoubleStream class in Java, import the following packageimport java.util.stream.DoubleStream;Create a DoubleStream and add some elements to the streamDoubleStream doubleStream = DoubleStream.of(67.9, 89.9, 10.5, 95.8, 49.6);Now, check if any of the elements match the predicateboolean res = doubleStream.anyMatch(a -> a > 50);The following is an example to implement DoubleStream anyMatch() method ... Read More
226 Views
To get the hash code value of the list, you need to use the hashCode() method of the CopyOnWriteArrayList class.The syntax is as followspublic int hashCode()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 hashCode() method in JavaExample Live Demoimport 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); arrList.add(120); ... Read More
8K+ Views
In this article, we will discuss all the approaches to parse a string delimited by comma using a C/C++ program. First of all, let's understand the problem statement. The input of this problem is a string containing multiple words that are seperated by commas. Our task is to print each word space seperated to the output console. For example: // Input String "Hello, World, From, 2025" // Output "Hello" "World" "From" "2025" Parse Comma Delimited String Here is the list of approaches to parse comma delimited string to words using c++ program, which we ... Read More
96 Views
The remainingCapacity() method of the ArrayBlockingQueue class in Java is used to return the number of additional elements that the queue can adopt without blocking.The syntax is as followsint remainingCapacity()To work with ArrayBlockingQueue class, you need to import the following packageimport java.util.concurrent.ArrayBlockingQueue;The following is an example to implement remainingCapacity() method of Java ArrayBlockingQueue classExample Live Demoimport java.util.concurrent.ArrayBlockingQueue; public class Demo { public static void main(String[] args) throws InterruptedException { ArrayBlockingQueue q = new ArrayBlockingQueue(10); q.add(120); q.add(400); q.add(450); q.add(500); System.out.println("ArrayBlockingQueue = " + ... Read More
1K+ Views
Sting Concatenatination is the process of creating a single string from multiple strings by combining them all together. In this article, we will discuss all approaches to concatenate multiple strings using C/C++ program. First of all, let's understand the problem statement. A set of C++ strings are given as input. We need to output a single string which is concatenate of the strings provided. For example: // Input Strings "Value " "is " "Big" // Output String "Value is Big" Concatenate Multiple Strings to Single Line Here is the list of approaches ... Read More