Skip to content

Instantly share code, notes, and snippets.

View appsfeature's full-sized avatar

Abhijit Rao appsfeature

View GitHub Profile
@appsfeature
appsfeature / gist:b709acffd8d3be20550838f3ef783f35
Last active June 23, 2024 07:47
Merging Lists : Now, you can merge the lists and filter out duplicates as shown below
private List<UserModel> filterDuplicateUsersInList(List<UserModel> topUsers, List<UserModel> lastUsers) {
// Create a set to filter out duplicates where LinkedHashSet maintain order
Set<UserModel> uniqueUsers = new LinkedHashSet<>(topUsers);
uniqueUsers.addAll(lastUsers); // Add all users from the second list
// Convert the set back to a list
List<UserModel> combinedUniqueList = new ArrayList<>(uniqueUsers);
Collections.sort(combinedUniqueList, new Comparator<UserModel>() {
@Override
public int compare(UserModel item, UserModel item2) {
Integer value = item.getRank();
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#F7F750" />
<stroke
android:width="0.2dp"
android:color="#B8B83B" />