Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GoikLectures
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Goik Martin
GoikLectures
Commits
62bc8bb8
Commit
62bc8bb8
authored
6 years ago
by
Goik Martin
Browse files
Options
Downloads
Patches
Plain Diff
Cosmetics
parent
95c7aab4
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Doc/Sd1/interfacesAbstractClasses.xml
+22
-19
22 additions, 19 deletions
Doc/Sd1/interfacesAbstractClasses.xml
with
22 additions
and
19 deletions
Doc/Sd1/interfacesAbstractClasses.xml
+
22
−
19
View file @
62bc8bb8
...
...
@@ -884,7 +884,7 @@ for (final Rectangle n : rectangles) {
</qandaset>
<figure
xml:id=
"sd1_fig_StringFlexibleSorting"
>
<title>
Flexibility in sorting
</title>
<title>
Situation dependent sorting criteria
</title>
<informaltable
border=
"0"
>
<colgroup
width=
"25%"
/>
...
...
@@ -946,7 +946,8 @@ public class SortCaseInsensitive implements <link
role=
"red"
>
String
</emphasis>
>
{
<emphasis
role=
"red"
>
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━┛
</emphasis>
@Override
<emphasis
role=
"red"
>
▼ ▼
</emphasis>
public int compare(final String a, final String b) {
public int compare(final
<emphasis
role=
"red"
>
String
</emphasis>
a, final
<emphasis
role=
"red"
>
String
</emphasis>
b) {
return
<emphasis
role=
"red"
>
a.toLowerCase()
</emphasis>
.compareTo(
<emphasis
role=
"red"
>
b.toLowerCase()
</emphasis>
);
}
...
...
@@ -1051,23 +1052,7 @@ Arrays.<link xlink:href="https://docs.oracle.com/javase/10/docs/api/java/util/Ar
for (final String n: names) {
System.out.println(n);
}
</programlisting><calloutlist>
<callout
arearefs=
"sd1_callout_StringSortIgnoreCaseLambda-1-co"
xml:id=
"sd1_callout_StringSortIgnoreCaseLambda-1"
>
<para>
This lambda expression is equivalent to the following
custom comparator:
</para>
<programlisting
language=
"none"
>
public class SortDescending implements
<link
xlink:href=
"https://docs.oracle.com/javase/10/docs/api/java/util/Comparator.html"
>
Comparator
</link>
<
String
>
{
@Override
public int compare(final String
<emphasis
role=
"red"
>
a
</emphasis>
, final String
<emphasis
role=
"red"
>
b
</emphasis>
) {
return
<emphasis
role=
"red"
>
b.compareTo(a)
</emphasis>
; // Equivalent to
<coref
linkend=
"sd1_callout_StringSortIgnoreCaseLambda-1-co"
/>
}
}
</programlisting>
</callout>
</calloutlist></td>
}
</programlisting></td>
<td
valign=
"top"
><screen>
sign
quick
...
...
@@ -1078,6 +1063,24 @@ ATM</screen></td>
</informaltable>
</figure>
<calloutlist>
<callout
arearefs=
"sd1_callout_StringSortIgnoreCaseLambda-1-co"
xml:id=
"sd1_callout_StringSortIgnoreCaseLambda-1"
>
<para>
This lambda expression is equivalent to the following custom
comparator:
</para>
<programlisting
language=
"none"
>
public class SortDescending implements
<link
xlink:href=
"https://docs.oracle.com/javase/10/docs/api/java/util/Comparator.html"
>
Comparator
</link>
<
String
>
{
@Override
public int compare(final String
<emphasis
role=
"red"
>
a
</emphasis>
, final String
<emphasis
role=
"red"
>
b
</emphasis>
) {
return
<emphasis
role=
"red"
>
b.compareTo(a)
</emphasis>
; // Equivalent to
<coref
linkend=
"sd1_callout_StringSortIgnoreCaseLambda-1-co"
/>
}
}
</programlisting>
</callout>
</calloutlist>
<qandaset
defaultlabel=
"qanda"
xml:id=
"sd1QandaArraysFlexibleSorting"
>
<title>
Adding flexibility in sorting rectangles
</title>
...
...
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