Code example for LinkedList

Methods: isEmpty, toString

0
			instances = getInstancesFromJson(jsonFromServer);
 
			if ( instances == null ) {
			    Log.d(TAG, taskName + "instances: null");
			} else { 
			    Log.d(TAG, taskName + "instances: " + instances.toString());
			} 
 
			if ( instances != null && !instances.isEmpty() ){
			    Log.d(TAG, taskName + ": saving instances in cache");
				Editor editor = PreferenceManager.getDefaultSharedPreferences(service).edit();
				editor.putString(taskName + LAST_UPDATE_JSON, jsonFromServer);
				editor.putLong(taskName + LAST_UPDATE, currentTime);
				editor.commit();
			} 
		} 
 
		if ( instances == null || instances.isEmpty() ) {
		    Log.d(TAG, taskName + ": getting instances from cache");
		    instances = getInstancesFromJson(getFromCache());
		} 
		 
		return instances;