Learn how to sort a list of pairs in Java.
Also find me here:
Baeldung Author
Kai Yuan
Kai Yuan has been a software developer for over 15 years. He builds enterprise Java applications in work. He has 20 years experience of Linux and is a big fan of the Vim editor. He is happy to help people at stackoverflow.com. He lives currently in Hamburg.
Here's what I've written (so far):
Baeldung on Java
- All
- Java String (41)
- Java List (25)
- Java Array (18)
- Core Java (18)
- Java Numbers (16)
- Java Map (15)
- Java IO (13)
- Java (11)
- Algorithms (9)
- Java Streams (8)
- Testing (7)
- Java Collections (5)
- Persistence (4)
- Maven (4)
- Spring Boot (2)
- Java Concurrency (2)
- XML (1)
- Spring Persistence (1)
- Networking (1)
- Java Web (1)
- Jakarta EE (1)
- Jackson (1)
- IDE (1)
Checking if an Element is the Last Element While Iterating Over an Array
Filed under Java Array
Learn how to check if the element you’re iterating over in the current iteration is the last one in the given Java array.
Checking if a StringBuilder Is Null or Empty
Filed under Java String
Learn how to check if a StringBuilder is null or empty in Java.
Remove All Elements From a String Array in Java
Filed under Java Array
Learn how to remove all elements from an array of Strings in Java.
Calculate the Sum of Diagonal Values in a 2d Java Array
Filed under Algorithms, Java Array
Learn about how to compute sums of the main and secondary diagonals in a two-dimensional array in Java.
Check if all Elements in an Array are Equal in Java
Filed under Java Array
Learn how to check if all the elements of an array are equal in Java.
Find the Substring After the Last Pattern in Java
Filed under Java String
Learn how to extract the suffix of a String after the last occurence of a pattern in Java.
How to Add String Arrays to ArrayList in Java
Filed under Java Array, Java List
Learn how to add elements from multiple String arrays to an ArrayList in Java.
How to Convert String to StringBuilder and Vice Versa in Java
Filed under Java String
Learn about how to convert to and from a String and StringBuilder in Java.
Baeldung on Linux
- All
- Scripting (36)
- Files (32)
- File Editing (21)
- Text Processing (11)
- File Searching (11)
- Processes (10)
- Administration (10)
- Filesystems (6)
- File Viewing (6)
- User Administration (4)
- Search (3)
- File Permissions (3)
- Web (2)
- Security (1)
- File Compression (1)
- Boot Process (1)
How to Limit grep Context to “n” Characters in a Line
Filed under File Searching
Learn how to limit the grep output characters displayed before and after the match.
Guide to Linux dirname Command with Examples
Learn how to use the dirname command in Linux to extract the directory part of a given path.
Guide to Linux basename Command with Examples
Learn about how to use the basename command to determine the file or folder name for one or more paths.
Printing Quote Characters in AWK
Filed under Text Processing
Learn how to print single or double quote characters in AWK scripts.
How to Read the First and the Last Line From Input
Filed under File Viewing
Learn how to extract the first and last lines from an input file using a single command.
Printing Specified Lines From a File
Filed under File Viewing
Learn how to extract specific lines from a file by line numbers using sed and awk.
Replace the First n Matched Instances in a File
Filed under File Editing
Learn how to replace the first n pattern occurrences in a file using sed and awk.
How to Operate on Files Listed in a File
Learn to use various techniques to operate on files listed in a file.
What’s the Meaning of $! in Bash Scripting
Learn the meaning of the special shell variable $!.
Baeldung on Kotlin
- All
- Kotlin Collections (18)
- Kotlin Classes and Objects (10)
- Kotlin Basics (10)
- Kotlin Numbers (9)
- Kotlin Strings (7)
- Kotlin Functions (5)
- Kotlin (4)
- Kotlin Arrays (3)
- Testing (2)
- Functional Programming (2)
- Spring (1)
- Security (1)
- Libraries (1)
- Algorithms (1)
Resolving Compile Error: “Const ‘val’ is only allowed on top level, in named objects, or in companion objects” in Kotlin
Filed under Kotlin Classes and Objects
Learn where and how you can use const val in Kotlin.
Resolving “Type Mismatch Inferred Type is Unit But Void Was Expected” in Kotlin
Filed under Kotlin Functions
Learn how to solve the “Unit but Void was expected” compilation error in Kotlin.
Iterating Enum Entries in Kotlin
Filed under Kotlin Basics
Learn how to loop over the entries of an Enum in Kotlin.
Difference Between clearAllMocks() and unmockkAll() in MockK
Filed under Testing
Learn about the difference between clearAllMocks() and unmockkAll() in MockK and when to use each one.
Serialize Enum Property to JSON in Kotlin
Filed under Libraries
Learn how to serialize a Kotlin enum property to JSON using Kotlin libraries.
Finding First Match in Nested Lists in Kotlin
Filed under Algorithms, Kotlin Collections
Learn how to search through a list of lists in Kotlin to find the first matching element.
Conditional Exception Throwing in Kotlin
Filed under Kotlin
Learn different approaches to throwing an exception when a condition is true in Kotlin.
Pass a Function as Parameter to Another in Kotlin
Filed under Kotlin Functions
Learn about how functions can be passed as parameters to other functions in Kotlin.
Matching Varargs Using MockK in Kotlin
Filed under Testing
Learn how to use the MockK mocking library to match varargs arguments in Kotlin.
Baeldung on Ops
- All
- Git (5)
Remove File From Git Repository Without Deleting It Locally
Filed under Git
Learn how to remove a file or directory from a Git repository but keep its local copy
How to Get the Current Branch Name in Git
Filed under Git
Learn how to get the Git branch name we’re currently working on
Delete a Git Branch Locally and Remotely
Filed under Git
Learn how to delete Git branches
Move Existing, Uncommitted Work to a New Branch in Git
Filed under Git
Learn a couple of quick ways to move uncommitted changes to a new Git branch
Squash the Last X Commits Using Git
Filed under Git
Learn what Git squashing is, talk about when we need to squash commits, and take a closer look at how to squash commits