List<CustomClass> foo = ArrayList<CustomClass> CustomClass cust = new CustomClass(); cust.setResult("Test"); cust.setCount(1); foo.add(cust);
class CustomClassJsFactory : public QObject { Q_OBJECT public: CustomClassFactory(QJSEngine* engine) : m_engine(engine) {} Q_INVOKABLE QJSValue createInstance() { // The engine takes ownership and destroys the object if no longer required. return m_engine->newQObject(new CustomClass()); } private: QJSEngine* m_engine; }
public class MyClass_ extends MyClass { private CustomClass member; public synchronized CustomClass getMember() { if (member == null){ member == new CustomClass(); } return member; } }
persistenceManager().currentTransaction().begin(); CustomClass customObj = new CustomClass(); customobj.setName("someName"); //set other values persistenceManager.makePeristent(customObj);//persist //comment this //SomeUtil.getRoot().getChildElements().add(customObj);//add to its owner persistenceManager.currentTransaction().commit();
ArrayList<CustomClass> circles = new ArrayList<CustomClass>(); circles.add( new CustomClass(60, 640, 400, 60, true) ); circles.add( new CustomClass(85, 580, 350, 60, true) );
public static void main(String[] args) { /// /// /// CustomClass mCustomClass = new CustomClass(); Client client = ClientBuilder.newClient(); String strResult = client.target(REST_SERVICE_URL).request(MediaType.APPLICATION_XML).put(Entity.xml(mCustomClass), String.class); }
try { System.out.println("begin"); CustomClass customClass=new CustomClass();` } finally { System.out.println("done"); }
try { System.out.println("Reached here 1"); CustomClass customClass=new CustomClass(); System.out.println("Reached here 2"); } catch (Exception e) { e.printStackTrace(); throw e; }
ArrayList<ArrayList<CustomClass>>data = new ArrayList<ArrayList<CustomClass>>(); ArrayList<CustomClass>d1 = new ArrayList<CustomClass>(); CustomClass temp = new CustomClass("this is my object"); d1.add(temp); data.add(d1); Intent intent = new Intent(JumpToMainActivity.ACTION); intent.putExtra("data",data); startActivity(intent);
myList.add(new CustomClass("adsf")); myList.add(new CustomClass("fdsa")); ParentClass.myList.add(new CustomClass("asdfasdf..")); ParentClass.myList.add(new CustomClass("fdsafdsa..."));
public static void main(String[] args) { String json = "[ [\"cd\",5,6,7], [\"rtt\",55,33,12], [\"by65\",87,87,12] ]"; List<CustomClass> customList = new ArrayList<CustomClass>(); String[][] data = new Gson().fromJson(json, String[][].class); for (String[] strArray : data){ customList.add(new CustomClass(strArray[0], Integer.parseInt(strArray[1]), Integer.parseInt(strArray[2]), Integer.parseInt(strArray[3]))); } System.out.println(customList); }
CustomClass customClassInstance = new CustomClass(); customClassInstance.setParam1(...); //...and so on Call<JsonArray> peticion= RetrofitClient.getRetrofitClient(getActivity()).sendParameters(settings.getString("imei", ""), settings.getString("idCliente", ""), customClassInstance);
public static List<CustomClass> parseString(String str) { String [] elements = str.split("\\["); List <CustomClass> result = new ArrayList<CustomClass>(); for (String elem : elements) { if (elem.contains("]")) { String seq = elem.substring(0, elem.indexOf(']')); String [] tokens = seq.split(","); result.add(new CustomClass(tokens[0].substring(1,tokens[0].length()-1), Integer.parseInt(tokens[1]), Integer.parseInt(tokens[2]), Integer.parseInt(tokens[3]))); } } return result; }
public CustomClass getindexedListobj(int index) { CustomClass tmp = null; for(CustomClass o : this.listobj) if(o.getId() == index) { tmp = o; break; } if(tmp == null) { tmp = new CustomClass(); this.listobj.add(tmp); } return tmp; }
public static final String URLPREFIX = "http://url/api"; HttpGet httpget = new HttpGet(URLPREFIX + "/method_name/token/" + mAuthKey); Log.e(TAG, "" + URLPREFIX + "/method_name/token/" + mAuthKey); try { // Execute HTTP Post Request HttpResponse response = httpclient.execute(httpget); HttpEntity entity = response.getEntity(); String jsonResponse = EntityUtils.toString(entity); Log.e(TAG, "entity: " + jsonResponse); JSONObject jsonObject = new JSONObject(jsonResponse); JSONArray jsonArray = jsonObject.getJSONArray("collection"); for (int i = 0; i < jsonArray.length(); i++) { JSONObject mFirstChild = jsonArray.getJSONObject(i); int mId = Integer.parseInt(mFirstChild.getString("id")); String mTitle = mFirstChild.getString("title"); arrayList.add(new CustomClass(mId, mTitle)); } } catch (Exception e) { e.printStackTrace(); }
CustomClass object = new CustomClass();
public void testCustomClass() throws Exception { long numberInserted = CACHE_SIZE / 10; Random random = new Random(); // Note that there is overhead for the map itself, so we will not get exactly the same amount // More than likely there will be a few hundred byte overhead for (float i = 0; i < numberInserted; i++) { cache.put(new CustomClass(randomStringFullOfInt(random, 10)), new CustomClass(randomStringFullOfInt(random, 10))); } assertTrue(cache.getAdvancedCache().getDataContainer().size() < numberInserted); }