- 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 4336 Articles for Java 8
![Nancy Den](https://www.tutorialspoint.com/assets/profiles/13557/profile/60_88439-1512714529.jpg)
409 Views
The summaryStatistics() method in the IntStream class is used to return summary data about the elements of this stream. The syntax is as follows:IntSummaryStatistics summaryStatistics()Create an IntStream and add some elements:IntStream intStream = IntStream.of(30, 60, 90);Now, get the summary data about the above elements:IntSummaryStatistics details = intStream.summaryStatistics();The following is an example to implement IntStream summaryStatistics() method in Java:Example Live Demoimport java.util.stream.IntStream; import java.util.IntSummaryStatistics; public class Demo { public static void main(String[] args) { IntStream intStream = IntStream.of(30, 60, 90); IntSummaryStatistics details = intStream.summaryStatistics(); System.out.println("Details = "+details); } }OutputDetails = IntSummaryStatistics{count=3, ... Read More
![Nancy Den](https://www.tutorialspoint.com/assets/profiles/13557/profile/60_88439-1512714529.jpg)
147 Views
To generate an infinite stream of integer, use the IntStream.iterate(). The method is used to iterator an IntStream.Import the following package for the IntStream class in Java:import java.util.stream.IntStream;The following is an example displaying how to generate Infinite Stream of Integers with IntStream.iterate() in Java:Exampleimport java.util.stream.IntStream; public class Main { public static void main(String[] args) { IntStream.iterate(0, k -> k + 2).forEach(System.out::println); } }Here is the output that displays integers infinitely:0 2 4 6 8 10 12 . . .
![Nancy Den](https://www.tutorialspoint.com/assets/profiles/13557/profile/60_88439-1512714529.jpg)
4K+ Views
The build() method in Stream.Builder class is used to build the stream. It returns the built stream.The syntax is as follows:Streaml build()Import the following package for the Stream.Builder class in Java:import java.util.stream.Stream;Declare a Stream.Builder:Stream.Builder builder = Stream.builder();Add some elements in the stream:builder.add("One"); builder.add("Two"); builder.add("Three");Now, use the build() method:Stream str = builder.build();The following is an example displaying how to implement build() method of Stream.Builder in Java:Example Live Demoimport java.util.stream.Stream; public class Demo { public static void main(String[] args) { Stream.Builder builder = Stream.builder(); builder.add("One"); builder.add("Two"); builder.add("Three"); ... Read More
![Nancy Den](https://www.tutorialspoint.com/assets/profiles/13557/profile/60_88439-1512714529.jpg)
114 Views
The count() method of the DoubleStream class returns the count of the elements in the stream.The syntax is as follows:long count()To use the DoubleStream class in Java, import the following package:import java.util.stream.DoubleStream;Create DoubleStream and add some elements:DoubleStream doubleStream = DoubleStream.of(50.8, 67.9, 35.7, 23.6, 89.9);Now, get the count of elements in the DoubleStream:long res = doubleStream.count();The following is an example to implement DoubleStream count() method in Java:Example Live Demoimport java.util.stream.DoubleStream; public class Demo { public static void main(String[] args) { DoubleStream doubleStream = DoubleStream.of(50.8, 67.9, 35.7, 23.6, 89.9); long res = doubleStream.count(); ... Read More
![Nancy Den](https://www.tutorialspoint.com/assets/profiles/13557/profile/60_88439-1512714529.jpg)
77 Views
The min() method of the DoubleStream class returns an OptionalDouble describing the minimum element of this stream, or an empty OptionalDouble if this stream is empty.The syntax is as follows:OptionalDoublemin()Here, OptionalDouble is a container object which may or may not contain a double valueTo use the DoubleStream class in Java, import the following package:import java.util.stream.DoubleStream;Create a DoubleStream and add elements to the stream:DoubleStream doubleStream = DoubleStream.of(67.9, 89.9, 10.5, 95.8, 49.6);Get the maximum element from the DoubleStream:OptionalDouble res = doubleStream.max();The following is an example to implement DoubleStream min() method in Java:Example Live Demoimport java.util.OptionalDouble; import java.util.stream.DoubleStream; public class Demo { public ... Read More
![Nancy Den](https://www.tutorialspoint.com/assets/profiles/13557/profile/60_88439-1512714529.jpg)
67 Views
The min() method of the LongStream class in Java returns an OptionalLong describing the minimum element of this stream, or an empty optional if this stream is empty.The syntax is as follows:OptionalLong min()Here, OptionalLong is a container object which may or may not contain a long value.To use the LongStream class in Java, import the following package:import java.util.stream.LongStream;The following is an example to implement LongStream min() method in Java. The isPresent() method of the OptionalLong class returns true if the value is present:Example Live Demoimport java.util.*; import java.util.stream.LongStream; public class Demo { public static void main(String[] args) { ... Read More
![Nancy Den](https://www.tutorialspoint.com/assets/profiles/13557/profile/60_88439-1512714529.jpg)
302 Views
The sequential() method of the IntStream class in Java is used to return a sequential IntStream. The syntax is as follows:IntStream sequential()First, create an IntStream and elements in a range using the range() method:IntStream intStream1 = IntStream.range(11, 21);Now, for a sequential IntStream, use the sequential() method like this:IntStream intStream2 = intStream1.sequential();The following is an example to implement IntStream sequential() method in Java:Example Live Demoimport java.util.*; import java.util.stream.IntStream; public class Demo { public static void main(String[] args) { IntStream intStream1 = IntStream.range(11, 21); IntStream intStream2 = intStream1.sequential(); intStream2.forEach(System.out::println); } }Output11 12 ... Read More
![Nitya Raut](https://www.tutorialspoint.com/assets/profiles/13573/profile/60_92249-1512715559.jpg)
5K+ Views
Stored procedures are sub routines, segment of SQL statements which are stored in SQL catalog. All the applications that can access Relational databases (Java, Python, PHP etc.), can access stored procedures.Stored procedures contain IN and OUT parameters or both. They may return result sets in case you use SELECT statements. Stored procedures can return multiple result sets.Retrieving Results from a procedure:You can call an existing stored procedure using the CallableStatement. The prepareCall() method of the Connection interface accepts the procedure call in string format and returns a callable statement object.CallableStatement cstmt = con.prepareCall("{call sampleProcedure()}");Execute the above created callable statement using ... Read More
![Vrundesha Joshi](https://www.tutorialspoint.com/assets/profiles/13566/profile/60_88163-1512715024.jpg)
1K+ Views
MongoDB is a cross-platform, document oriented database that provides, high performance, high availability, and easy scalability. MongoDB works on concept of collection and document.Before you start connecting MongoDB in you need to make sure that you have MongoDB JDBC driver. If not, download the jar from the path Download mongo.jar and, add it to your classpath.ExampleFollowing JDBC program establishes connection with the MongoDB database and creates a collection in it.import com.mongodb.client.MongoDatabase; import com.mongodb.MongoClient; import com.mongodb.MongoCredential; public class CreatingCollection { public static void main( String args[] ) { // Creating a Mongo client MongoClient ... Read More
![Jennifer Nicholas](https://www.tutorialspoint.com/assets/profiles/13569/profile/60_88876-1512715262.jpg)
761 Views
PostgreSQL is an open source relational database management system (DBMS) developed by a worldwide team of volunteers. PostgreSQL is not controlled by any corporation or other private entity and the source code is available free of charge.PostgreSQL runs on all major operating systems, including Linux, UNIX (AIX, BSD, HP-UX, SGI IRIX, Mac OS X, Solaris, Tru64), and Windows. It supports text, images, sounds, and video, and includes programming interfaces for C / C++, Java, Perl, Python, Ruby, Tcl and Open Database Connectivity (ODBC).Download the latest version of postgresql- from postgresql-jdbc repository.Add downloaded jar file postgresql-(VERSION).jdbc.jar in your class path.ExampleFollowing JDBC program ... Read More