FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
java8Examples/Java8Examples/src/readfile/ReadFileStream.java at master · suatoz/java8Examples · GitHub
suatoz
/
java8Examples
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
java8Examples
/
Java8Examples
/
src
/
readfile
/
ReadFileStream.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
55 lines (46 loc) · 1.59 KB
Breadcrumbs
java8Examples
/
Java8Examples
/
src
/
readfile
/
ReadFileStream.java
Copy path
File metadata and controls
55 lines (46 loc) · 1.59 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package
readfile
;
import
java
.
io
.
BufferedReader
;
import
java
.
io
.
IOException
;
import
java
.
nio
.
file
.
Files
;
import
java
.
nio
.
file
.
Paths
;
import
java
.
util
.
ArrayList
;
import
java
.
util
.
List
;
import
java
.
util
.
stream
.
Collectors
;
import
java
.
util
.
stream
.
Stream
;
public
class
ReadFileStream
{
static
String
fileName
=
"d:/lines.txt"
;
public
static
void
main
(
String
[]
args
) {
readFileGen
();
System
.
err
.
println
(
"<---------------------------------------------------------------->"
);
readFileGenExtra
();
System
.
err
.
println
(
"<---------------------------------------------------------------->"
);
linesMethod
();
String
den
=
"deneme"
;
den
.
chars
().
mapToObj
(
x
-> (
char
)
x
).
forEach
(
System
.
out
::
println
);
}
private
static
void
readFileGen
() {
try
(
Stream
<
String
>
stream
=
Files
.
lines
(
Paths
.
get
(
fileName
))){
stream
.
forEach
(
System
.
out
::
println
);
}
catch
(
IOException
e
) {
e
.
printStackTrace
();
}
}
private
static
void
readFileGenExtra
() {
List
<
String
>
list
=
new
ArrayList
<>();
try
(
Stream
<
String
>
stream
=
Files
.
lines
(
Paths
.
get
(
fileName
))){
list
=
stream
.
filter
(
line
->!
line
.
startsWith
(
"line3"
)).
map
(
String
::
toUpperCase
).
collect
(
Collectors
.
toList
());
}
catch
(
IOException
e
) {
e
.
printStackTrace
();
}
list
.
forEach
(
System
.
out
::
println
);
}
private
static
void
linesMethod
() {
List
<
String
>
list
=
new
ArrayList
<>();
try
(
BufferedReader
br
=
Files
.
newBufferedReader
(
Paths
.
get
(
fileName
))){
list
=
br
.
lines
().
collect
(
Collectors
.
toList
());
}
catch
(
IOException
e
) {
e
.
printStackTrace
();
}
list
.
forEach
(
System
.
out
::
println
);
}
}
Back
|
FazBrowse Home
|
New Git URL