Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jvstd1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Patryk Czarnik
jvstd1
Commits
ab6def50
Commit
ab6def50
authored
Oct 16, 2024
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MojFrameworkFuncyjny
parent
7cda91dc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
0 deletions
+32
-0
MojFrameworkFunkcyjny.java
src/main/java/p17_lambdy/MojFrameworkFunkcyjny.java
+15
-0
MojProgram.java
src/main/java/p17_lambdy/MojProgram.java
+17
-0
No files found.
src/main/java/p17_lambdy/MojFrameworkFunkcyjny.java
0 → 100644
View file @
ab6def50
package
p17_lambdy
;
public
class
MojFrameworkFunkcyjny
{
/** Aplikuje podaną funkcję do każdego elementu podanej tablicy.
* W tablicy w miejsce argumentów zapisywane są wynikowe wartości.
* @param t
* @param f
*/
public
static
void
zastosujDoTablicy
(
double
[]
t
,
FunkcjaLiczbowa
f
)
{
for
(
int
i
=
0
;
i
<
t
.
length
;
i
++)
{
t
[
i
]
=
f
.
oblicz
(
t
[
i
]);
}
}
}
src/main/java/p17_lambdy/MojProgram.java
0 → 100644
View file @
ab6def50
package
p17_lambdy
;
import
java.util.Arrays
;
public
class
MojProgram
{
public
static
void
main
(
String
[]
args
)
{
double
[]
a
=
{
0
,
1
,
2
,
4.5
,
18
,
625.0
/
2
,
0.125
};
System
.
out
.
println
(
Arrays
.
toString
(
a
));
MojFrameworkFunkcyjny
.
zastosujDoTablicy
(
a
,
x
->
2
*
x
);
System
.
out
.
println
(
Arrays
.
toString
(
a
));
MojFrameworkFunkcyjny
.
zastosujDoTablicy
(
a
,
Math:
:
sqrt
);
System
.
out
.
println
(
Arrays
.
toString
(
a
));
MojFrameworkFunkcyjny
.
zastosujDoTablicy
(
a
,
x
->
x
*
x
);
System
.
out
.
println
(
Arrays
.
toString
(
a
));
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment