FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
java_upgrade/src/test/java/streams/SumEvens.java at main · ps4/java_upgrade · GitHub
ps4
/
java_upgrade
Public
forked from
kousen/java_upgrade
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
java_upgrade
/
src
/
test
/
java
/
streams
/
SumEvens.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
35 lines (27 loc) · 779 Bytes
Breadcrumbs
java_upgrade
/
src
/
test
/
java
/
streams
/
SumEvens.java
Copy path
File metadata and controls
35 lines (27 loc) · 779 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package
streams
;
import
org
.
junit
.
jupiter
.
api
.
Test
;
import
java
.
util
.
Arrays
;
import
java
.
util
.
List
;
import
java
.
util
.
function
.
IntPredicate
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertEquals
;
public
class
SumEvens
{
private
static
final
IntPredicate
EVENS
=
n
->
n
%
2
==
0
;
private
static
final
IntPredicate
ODDS
=
n
->
n
%
2
!=
0
;
@
Test
public
void
addEvenElements
() {
List
<
Integer
>
integers
=
Arrays
.
asList
(
3
,
1
,
4
,
1
,
5
,
9
,
2
,
6
,
5
);
int
sum
=
0
;
for
(
int
n
:
integers
) {
if
(
n
%
2
==
0
) {
sum
+=
n
;
}
}
assertEquals
(
12
,
sum
);
}
@
Test
public
void
addEvenElementsUsingStreams
() {
}
@
Test
public
void
addOddElementsUsingStreams
() {
}
}
Back
|
FazBrowse Home
|
New Git URL