Skip to content

Instantly share code, notes, and snippets.

@xaverkapeller
xaverkapeller / SortedListAdapter.java
Last active November 16, 2020 05:33
Implementation of a RecyclverView Adapter base class which uses a SortedList internally
import android.content.Context;
import android.support.v7.util.SortedList;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@xaverkapeller
xaverkapeller / MemoryRepository.java
Created November 29, 2016 18:10
A Repository implementation backed by an in memory Map. Intended to be subclassed for an Entity.
import org.springframework.data.repository.CrudRepository;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.BiConsumer;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collectors;