Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
alx_mszczonow_1
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
alx_mszczonow_1
Commits
1ecbc015
Commit
1ecbc015
authored
Jun 27, 2023
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Kolekcje - popraweczki
parent
c7b868ae
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
4 deletions
+5
-4
Konkurencja3.java
src/main/java/p22_kolekcje/e_iterator/Konkurencja3.java
+1
-1
Konkurencja4.java
src/main/java/p22_kolekcje/e_iterator/Konkurencja4.java
+2
-2
KomparatorDlugosciNapisow.java
.../p22_kolekcje/s_sortowanie/KomparatorDlugosciNapisow.java
+1
-0
Sortowanie2.java
src/main/java/p22_kolekcje/s_sortowanie/Sortowanie2.java
+1
-1
No files found.
src/main/java/p22_kolekcje/e_iterator/Konkurencja3.java
View file @
1ecbc015
...
...
@@ -24,7 +24,7 @@ public class Konkurencja3 {
if
(
element
.
charAt
(
0
)
==
'o'
)
{
// lista.set(3, "Agata"); // to nie spowodowało błędu
lista
.
remove
(
2
);
// to psuje działanie pętli for-each
lista
.
remove
(
2
);
// lista.add("ewa"); // to też psuje
System
.
out
.
println
(
"już usunąłem"
);
//break;
...
...
src/main/java/p22_kolekcje/e_iterator/Konkurencja4.java
View file @
1ecbc015
...
...
@@ -17,11 +17,11 @@ public class Konkurencja4 {
// w trakcie przeglądania jej jakimś iteratorem
// pętla for-each ma w sobie zaszyty niejawny iterator
for
(
String
element
:
lista
)
{
System
.
out
.
println
(
element
);
System
.
out
.
println
(
" * "
+
element
);
if
(
element
.
charAt
(
0
)
==
'o'
)
{
// lista.set(3, "Agata"); // to nie spowodowało błędu
lista
.
remove
(
2
);
// to psuje działanie pętli for-each
lista
.
remove
(
2
);
// to psuje działanie pętli for-each
- przy pobraniu następnego elementu
// lista.add("ewa"); // to też psuje
System
.
out
.
println
(
"już usunąłem"
);
}
...
...
src/main/java/p22_kolekcje/s_sortowanie/KomparatorDlugosciNapisow.java
View file @
1ecbc015
...
...
@@ -8,6 +8,7 @@ public class KomparatorDlugosciNapisow implements Comparator<String> {
* Jeśli zwracam >0 to znaczy że s1 uważam za większe.
* Jeśli zwracam 0 to znaczy, że są równe.
*/
// System.out.println("comp " + s1 + " | " + s2);
return
s1
.
length
()
-
s2
.
length
();
}
}
src/main/java/p22_kolekcje/s_sortowanie/Sortowanie2.java
View file @
1ecbc015
...
...
@@ -29,7 +29,7 @@ public class Sortowanie2 {
System
.
out
.
println
(
lista
);
// Drugi sposób utworzenia komparatora: klasa anonimowa
// Składnia dost
e
pna od początków Javy
// Składnia dost
ę
pna od początków Javy
System
.
out
.
println
(
"\nlista.sort( klasa anonimowa )"
);
lista
.
sort
(
new
Comparator
<
String
>()
{
public
int
compare
(
String
s1
,
String
s2
)
{
...
...
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