Java tutorial
//package com.java2s; import android.support.v4.util.LruCache; import android.text.SpannableString; public class Main { public static LruCache<String, SpannableString> getInSize(int size) { return new LruCache<String, SpannableString>(size) { @Override protected int sizeOf(String key, SpannableString value) { return value.length(); } @Override protected SpannableString create(String key) { return null; } }; } }