Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.HashSet;

import java.util.Set;

import android.content.SharedPreferences;

public class Main {
    public static Set<String> loadSet(SharedPreferences prefs, String setName) {
        final int size = prefs.getInt(setName + "_size", 0);
        Set<String> set = new HashSet<String>(size);
        for (int i = 0; i < size; i++)
            set.add(prefs.getString(setName + "_" + i, null));
        return set;
    }
}