Skip to content

Commit 12b34c1

Browse files
committed
Update java-programs.md
1 parent b0f5771 commit 12b34c1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

java-programs.md

+13
Original file line numberDiff line numberDiff line change
@@ -1900,6 +1900,19 @@ LocalDateTime.ofInstant ( new Date().toInstant(), ZoneId.systemDefault());
19001900
<b><a href="#">↥ back to top</a></b>
19011901
</div>
19021902

1903+
## Q. How to sort a list of strings using a lambda expression?
1904+
1905+
```java
1906+
public static List < String > sort ( List < String > list) {
1907+
Collections.sort(list, (a, b) -> a.compareTo(b));
1908+
return list;
1909+
}
1910+
```
1911+
1912+
<div align="right">
1913+
<b><a href="#related-topics">↥ back to top</a></b>
1914+
</div>
1915+
19031916
#### Q. How to find if there is a sub array with sum equal to zero?
19041917
#### Q. How to remove a given element from array in Java?
19051918
#### Q. How to find trigonometric values of an angle in java?

0 commit comments

Comments
 (0)