Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lab_reactive_java
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
rtbdp
labs
lab_reactive_java
Commits
4e31ad94
Commit
4e31ad94
authored
8 years ago
by
Stuart Marks
Browse files
Options
Downloads
Patches
Plain Diff
remove exercises for DoublePredicate and BiFunction
parent
9cba9f2a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
LambdaLab/test/exercises/A_LambdasAndMethodReferences.java
+1
-65
1 addition, 65 deletions
LambdaLab/test/exercises/A_LambdasAndMethodReferences.java
LambdaLab/test/solutions/A_LambdasAndMethodReferences.java
+1
-65
1 addition, 65 deletions
LambdaLab/test/solutions/A_LambdasAndMethodReferences.java
with
2 additions
and
130 deletions
LambdaLab/test/exercises/A_LambdasAndMethodReferences.java
+
1
−
65
View file @
4e31ad94
...
...
@@ -4,9 +4,7 @@ import java.util.ArrayList;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.function.BiFunction
;
import
java.util.function.Consumer
;
import
java.util.function.DoublePredicate
;
import
java.util.function.Function
;
import
java.util.function.Predicate
;
import
java.util.function.Supplier
;
...
...
@@ -139,69 +137,7 @@ public class A_LambdasAndMethodReferences {
}
@Test
@Ignore
public
void
a13doublepredicate
()
{
// TODO: write a lambda expression that tests whether a double value
// is greater than 10.0.
DoublePredicate
pred
=
d
->
d
>
10.0
;
assertTrue
(
pred
.
test
(
15.0
));
assertFalse
(
pred
.
test
(
5.0
));
}
@Test
@Ignore
public
void
a14doublepredicate
()
{
// TODO: write a lambda expression that tests whether a double value
// is finite.
DoublePredicate
pred
=
d
->
Double
.
isFinite
(
d
);
assertTrue
(
pred
.
test
(
0.0
));
assertFalse
(
pred
.
test
(
Double
.
POSITIVE_INFINITY
));
}
@Test
@Ignore
public
void
a15doublepredicate
()
{
// TODO: write a method reference that tests whether a double value
// is finite.
DoublePredicate
pred
=
Double:
:
isFinite
;
assertTrue
(
pred
.
test
(
0.0
));
assertFalse
(
pred
.
test
(
Double
.
POSITIVE_INFINITY
));
}
@Test
@Ignore
public
void
a16bifunction
()
{
// TODO: write a lambda expression, given two strings, returns the result
// of concatenating the first, followed by the second, followed by the
// first again.
BiFunction
<
String
,
String
,
String
>
bifunc
=
(
s1
,
s2
)
->
s1
+
s2
+
s1
;
assertEquals
(
"abcdefabc"
,
bifunc
.
apply
(
"abc"
,
"def"
));
}
@Test
@Ignore
public
void
a17bifunction
()
{
// TODO: write a lambda expression that returns the index of
// the first occurrence the second string within the first string,
// or -1 if the second string doesn't occur within the first string.
BiFunction
<
String
,
String
,
Integer
>
bifunc
=
(
s1
,
s2
)
->
s1
.
indexOf
(
s2
);
assertTrue
(
bifunc
.
apply
(
"abcdefghi"
,
"def"
)
==
3
);
assertTrue
(
bifunc
.
apply
(
"abcdefghi"
,
"xyz"
)
==
-
1
);
}
@Test
@Ignore
public
void
a18bifunction
()
{
// TODO: write a method reference that returns the index of
// the first occurrence the second string within the first string,
// or -1 if the second string doesn't occur within the first string.
BiFunction
<
String
,
String
,
Integer
>
bifunc
=
String:
:
indexOf
;
assertTrue
(
bifunc
.
apply
(
"abcdefghi"
,
"def"
)
==
3
);
assertTrue
(
bifunc
.
apply
(
"abcdefghi"
,
"xyz"
)
==
-
1
);
}
@Test
@Ignore
public
void
a19runnable
()
{
public
void
a13runnable
()
{
StringBuilder
sb
=
new
StringBuilder
(
"abc"
);
String
suffix
=
"xyz"
;
...
...
This diff is collapsed.
Click to expand it.
LambdaLab/test/solutions/A_LambdasAndMethodReferences.java
+
1
−
65
View file @
4e31ad94
...
...
@@ -4,9 +4,7 @@ import java.util.ArrayList;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.function.BiFunction
;
import
java.util.function.Consumer
;
import
java.util.function.DoublePredicate
;
import
java.util.function.Function
;
import
java.util.function.Predicate
;
import
java.util.function.Supplier
;
...
...
@@ -172,69 +170,7 @@ public class A_LambdasAndMethodReferences {
}
@Test
public
void
a13doublepredicate
()
{
// TODO: write a lambda expression that tests whether a double value
// is greater than 10.0.
DoublePredicate
pred
=
d
->
d
>
10.0
;
assertTrue
(
pred
.
test
(
15.0
));
assertFalse
(
pred
.
test
(
5.0
));
}
@Test
public
void
a14doublepredicate
()
{
// TODO: write a lambda expression that tests whether a double value
// is finite.
DoublePredicate
pred
=
d
->
Double
.
isFinite
(
d
);
assertTrue
(
pred
.
test
(
0.0
));
assertFalse
(
pred
.
test
(
Double
.
POSITIVE_INFINITY
));
}
@Test
public
void
a15doublepredicate
()
{
// TODO: write a method reference that tests whether a double value
// is finite.
DoublePredicate
pred
=
Double:
:
isFinite
;
assertTrue
(
pred
.
test
(
0.0
));
assertFalse
(
pred
.
test
(
Double
.
POSITIVE_INFINITY
));
}
@Test
public
void
a16bifunction
()
{
// TODO: write a lambda expression, given two strings, returns the result
// of concatenating the first, followed by the second, followed by the
// first again.
BiFunction
<
String
,
String
,
String
>
bifunc
=
(
s1
,
s2
)
->
s1
+
s2
+
s1
;
assertEquals
(
"abcdefabc"
,
bifunc
.
apply
(
"abc"
,
"def"
));
}
@Test
public
void
a17bifunction
()
{
// TODO: write a lambda expression that returns the index of
// the first occurrence the second string within the first string,
// or -1 if the second string doesn't occur within the first string.
BiFunction
<
String
,
String
,
Integer
>
bifunc
=
(
s1
,
s2
)
->
s1
.
indexOf
(
s2
);
assertTrue
(
bifunc
.
apply
(
"abcdefghi"
,
"def"
)
==
3
);
assertTrue
(
bifunc
.
apply
(
"abcdefghi"
,
"xyz"
)
==
-
1
);
}
@Test
public
void
a18bifunction
()
{
// TODO: write a method reference that returns the index of
// the first occurrence the second string within the first string,
// or -1 if the second string doesn't occur within the first string.
BiFunction
<
String
,
String
,
Integer
>
bifunc
=
String:
:
indexOf
;
assertTrue
(
bifunc
.
apply
(
"abcdefghi"
,
"def"
)
==
3
);
assertTrue
(
bifunc
.
apply
(
"abcdefghi"
,
"xyz"
)
==
-
1
);
}
@Test
public
void
a19runnable
()
{
public
void
a13runnable
()
{
StringBuilder
sb
=
new
StringBuilder
(
"abc"
);
String
suffix
=
"xyz"
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment