com.grepsound.model.Users.java Source code

Java tutorial

Introduction

Here is the source code for com.grepsound.model.Users.java

Source

package com.grepsound.model;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.util.ArrayList;

/**
 * "THE BEER-WARE LICENSE" (Revision 42):
 * <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you
 * can do whatever you want with this stuff. If we meet some day, and you think
 * this stuff is worth it, you can buy me a beer in return
 *
 * Alexandre Lision on 2014-06-25.
 */

public class Users extends ArrayList<User> {

    public Users() {

    }

    public Users(JSONArray result) {
        for (int i = 0; i < result.length(); ++i) {
            try {
                add(new User((JSONObject) result.get(i)));
            } catch (IOException e) {
                e.printStackTrace();
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    }
}