package com.bignerdranch.android.criminalintent;

import android.content.Context;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

public class CrimeLab {
    private static CrimeLab sCrimeLab;

    private ArrayList<Crime> mCrimes;

    public static CrimeLab get(Context context) {
        if (sCrimeLab == null) {
            sCrimeLab = new CrimeLab(context);
        }
        return sCrimeLab;
    }

    private CrimeLab(Context context) {
        mCrimes = new ArrayList<>();
    }

    public void addCrime(Crime c) {
        mCrimes.add(c);
    }

    public List<Crime> getCrimes() {
        return mCrimes;
    }

    public Crime getCrime(UUID id) {
        for (Crime crime : mCrimes) {
            if (crime.getId().equals(id)) {
                return crime;
            }
        }
        return null;
    }
}

@@ -503,16 +503,227 @@
 ist%3C%3E();
+%0A%0A        for (int i = 0; i %3C 100; i++) %7B%0A            Crime crime = new Crime();%0A            crime.setSolved(i %25 2 == 0);%0A            crime.setTitle(%22Case #%22 + (i + 1));%0A            mCrimes.add(crime);%0A        %7D
 %0A    %7D%0A%0A

Add sample data.