- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 34475 Articles for Programming
![Daniol Thomas](https://www.tutorialspoint.com/assets/profiles/13551/profile/60_130035-1512726078.jpg)
74 Views
The listIterator() method of the AbstractList class in Java is used to return a list iterator over the elements in this list, beginning at the specified position in the list.The syntax is as follows.public ListIterator listIterator(int index)Here, index is the index of the first element to be returned from the list iterator, whereas, ListIterator is an iterator for lists.To work with the AbstractList class, import the following package.import java.util.AbstractList;For ListIterator, import the following package.import java.util.ListIterator;The following is an example to implement listIterator() method of the AbstractlList class in Java.Example Live Demoimport java.util.ArrayList; import java.util.ListIterator; import java.util.AbstractList; public class Demo { ... Read More
![Jennifer Nicholas](https://www.tutorialspoint.com/assets/profiles/13569/profile/60_88876-1512715262.jpg)
93 Views
Priority queues are a type of container adapters, in which the first element of the queue is the greatest of all elements in the queue. Elements are in also non decreasing order in the priority queue. An element with high priority is served before an element with low priority, in a priority queue.Functions and descriptions:Functions used here: pq.size() = Returns the size of priority queue. pq.insert) = It is used to insert elements to the priority queue. pq.delete() = Deletes the value from the priority queue. pq.top() = Returns a reference to the top most element ... Read More
![Daniol Thomas](https://www.tutorialspoint.com/assets/profiles/13551/profile/60_130035-1512726078.jpg)
168 Views
The iterator() method of the ArrayBlockingQueue class returns an iterator over the elements in this queue in proper sequence.The syntax is as follows.public Iterator iterator()To work with ArrayBlockingQueue class, you need to import the following package.import java.util.concurrent.ArrayBlockingQueue;The following is an example to implement iterator() method of Java ArrayBlockingQueue class.Example 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); q.add(400); q.add(450); q.add(500); q.add(550); ... Read More
![Nitya Raut](https://www.tutorialspoint.com/assets/profiles/13573/profile/60_92249-1512715559.jpg)
77 Views
Prev_permutation in STL is used to rearrange the elements in the range [first, last] into the previous lexicographically smaller permutation. A permutation is each one of the N! possible arrangements the elements can take. Here is a C++ program to implement Prev_permutation in STL.AlgorithmBegin Define one integer array variable elements[]. Get the number of data e from the user. Initialize the array elements[] with e number of data from the keyboard. Sort all the array elements. Reverse the array elements. Do show(elements) //to display the current content of the array ... Read More
![Vrundesha Joshi](https://www.tutorialspoint.com/assets/profiles/13566/profile/60_88163-1512715024.jpg)
272 Views
Pair is a simple container which consists of two data object:‘first’ = The first element is referenced as ‘first’ ‘second’ = the second element and the order is fixed (first, second).Pair can be assigned, compared and copied. It is used to combine together two values which may be different in type.Syntax is: pairvariable name(datavalue1, datavalue2).AlgorithmBegin Write pairvariable name(datavalue1,datavalue2) Print the pairs EndExample Code#include using namespace std; int main() { pair value('a',7); pair fruit ("grapes",2.30); pair food ("pulao",200); cout
![Daniol Thomas](https://www.tutorialspoint.com/assets/profiles/13551/profile/60_130035-1512726078.jpg)
784 Views
The collectingAndThen() method in Java Collectors class acclimates a Collector to perform an additional finishing transformation. It returns collector which performs the action of the downstream collector, followed by an additional ending step.The syntax is as follows.static Collector collectingAndThen(Collector downstream, Function finisher)Here, the parameter, T − Type of the input elementsA − Intermediate accumulation type of the downstream collectorR − The result type of the downstream collectorRR − The result type of the resulting collectordownstream − Collectorfinisher − A function to be applied to the final result of the downstream collectorTo work with Collectors class in Java, import the ... Read More
![Nitya Raut](https://www.tutorialspoint.com/assets/profiles/13573/profile/60_92249-1512715559.jpg)
275 Views
Next_permutation in STL is used to rearrange the elements in the range [first, last] into the next lexicographically greater permutation. A permutation is each one of the N! possible arrangements the elements can take. This is C++ program to implement Next_permutation in STL.AlgorithmBegin Define one integer array variable elements[]. Get the number of data e from the user. Initialize the array elements[] with e number of data from the keyboard. Sort all the array elements. do show(elements, e) //to display the current content of the array while (next_permutation(elements, elements + e)) ... Read More
![Vrundesha Joshi](https://www.tutorialspoint.com/assets/profiles/13566/profile/60_88163-1512715024.jpg)
148 Views
A multiset is a type of associative container in which has multiple elements can have same values.Functions and descriptions:Functions are used here: ms.size() = Returns the size of multiset. ms.insert) = It is used to insert elements to the multiset. ms.erase() = Removes the value from the multiset. ms.find() = Returns an iterator to the search element in the multiset if found, else returns the iterator to end. ms.count() = Returns the number of matches element in the multiset. ms.begin() = Returns an iterator to the first element in the multiset. ms.end() ... Read More
![Daniol Thomas](https://www.tutorialspoint.com/assets/profiles/13551/profile/60_130035-1512726078.jpg)
540 Views
The mapToLong() function in IntStream class returns a LongStream consisting of the results of applying the given function to the elements of this stream.The syntax is as follows.LongStream mapToLong(IntToLongFunction mapper)Here, the parameter mapper is a stateless function to apply to each element.Create an IntStream with some elements in the Stream.IntStream intStream = IntStream.of(50, 100, 150, 200);Now create a LongStream and use the mapToLong() with a condition.LongStream longStream = intStream.mapToLong(num → (long)num);The following is an example to implement IntStream mapToLong() method in Java.Exampleimport java.util.*; import java.util.stream.IntStream; import java.util.stream.LongStream; public class Demo { public static void main(String[] args) { ... Read More