Java tutorial
//package com.java2s; //License from project: Open Source License import android.graphics.Matrix; public class Main { private static final ThreadLocal<Matrix> objects = new ThreadLocal<Matrix>() { @Override protected Matrix initialValue() { return new Matrix(); } }; public static Matrix get() { Matrix matrix = objects.get(); matrix.reset(); return matrix; } }