About Question enthuware.ocpjp.ii.v11.2.1882 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
sir_Anduin@yahoo.de
Posts: 62
Joined: Fri Aug 07, 2015 2:16 pm
Contact:

About Question enthuware.ocpjp.ii.v11.2.1882 :

Post by sir_Anduin@yahoo.de »

is there any pattern for count, size, length and their return type?
maybe all new api return long from count?

admin
Site Admin
Posts: 10046
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.ii.v11.2.1882 :

Post by admin »

Generally, size and length are int and count and sum are in long. But you should not rely on it because there is no documented rule. You might see a method that doesn't follow it.
If you like our products and services, please help us by posting your review here.

codeappman@gmail.com
Posts: 3
Joined: Fri Sep 20, 2019 11:53 am
Contact:

Re: About Question enthuware.ocpjp.ii.v11.2.1882 :

Post by codeappman@gmail.com »

count is always long/Long.

In IntStream, LongStream, DoubleStream
long count()

In Collectors
Long counting()

size() in List is 'int', length in array and string is also 'int'. However, these two are too fundamental, I think it's unlikely to trick you with them in OCPJP.

kevvvvyp
Posts: 4
Joined: Wed Jun 05, 2019 3:22 pm
Contact:

Re: About Question enthuware.ocpjp.ii.v11.2.1882 :

Post by kevvvvyp »

admin wrote:
Sun Sep 15, 2019 8:29 am
Generally, size and length are int and count and sum are in long. But you should not rely on it because there is no documented rule. You might see a method that doesn't follow it.
With regards to sum:
- IntStream sum() returns int
- DoubleStream sum() returns double
- LongStream sum() returns long

Post Reply

Who is online

Users browsing this forum: No registered users and 76 guests