Java Code Examples for java.util.List

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project 2Degrees-Toolbox, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: AnimatorSet.java

  208 
vote

/**  * Sets up this AnimatorSet to play each of the supplied animations when the previous animation ends. * @param items The animations that will be started one after another. */public void playSequentially(List<Animator> items){  if (items != null && items.size() > 0) {    mNeedsSort=true;    if (items.size() == 1) {      play(items.get(0));    } else {      for (int i=0; i < items.size() - 1; ++i) {        play(items.get(i)).before(items.get(i + 1));      }    }  }} 

Example 2

From project 4308Cirrus, under directory /Extras/actionbarsherlock/src/com/actionbarsherlock/internal/nineoldandroids/animation/.

Source file: AnimatorSet.java

  105 
vote

/** 
 * Sets up this AnimatorSet to play each of the supplied animations when the previous animation ends.
 * @param items The animations that will be started one after another.
 */
public void playSequentially(List<Animator> items){
  if (items != null && items.size() > 0) {
    mNeedsSort=true;
    if (items.size() == 1) {
      play(items.get(0));
    }
 else {
      for (int i=0; i < items.size() - 1; ++i) {
        play(items.get(i)).before(items.get(i + 1));
      }
    }
  }
}
 

Example 3

From project 2Degrees-Toolbox, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: ActionMenu.java

  61 
vote

public int addIntentOptions(int groupId,int itemId,int order,ComponentName caller,Intent[] specifics,Intent intent,int flags,MenuItem[] outSpecificItems){
  PackageManager pm=mContext.getPackageManager();
  final List<ResolveInfo> lri=pm.queryIntentActivityOptions(caller,specifics,intent,0);
  final int N=lri != null ? lri.size() : 0;
  if ((flags & FLAG_APPEND_TO_GROUP) == 0) {
    removeGroup(groupId);
  }
  for (int i=0; i < N; i++) {
    final ResolveInfo ri=lri.get(i);
    Intent rintent=new Intent(ri.specificIndex < 0 ? intent : specifics[ri.specificIndex]);
    rintent.setComponent(new ComponentName(ri.activityInfo.applicationInfo.packageName,ri.activityInfo.name));
    final MenuItem item=add(groupId,itemId,order,ri.loadLabel(pm)).setIcon(ri.loadIcon(pm)).setIntent(rintent);
    if (outSpecificItems != null && ri.specificIndex >= 0) {
      outSpecificItems[ri.specificIndex]=item;
    }
  }
  return N;
}
 

Example 4

From project Aardvark, under directory /aardvark/src/main/test/gw/vark/it/.

Source file: ForkedAntProcess.java

  53 
vote

@Override protected List<File> createClasspath(){
  try {
    File assemblyDir=ITUtil.getAssemblyDir();
    File libDir=new File(assemblyDir,"lib");
    File antJar=ITUtil.findFile(libDir,"ant-[\\d\\.]+\\.jar");
    File antLauncherJar=ITUtil.findFile(libDir,"ant-launcher-[\\d\\.]+\\.jar");
    return Arrays.asList(antJar,antLauncherJar);
  }
 catch (  FileNotFoundException e) {
    throw new RuntimeException(e);
  }
}
 

Example 5

From project Absolute-Android-RSS, under directory /src/com/AA/Services/.

Source file: RssService.java

  50 
vote

/** 
 * Writes the received data to the application settings so that data restoration is easier
 * @param articleList - List of all the articles that have been aggregated from the stream
 */
public static void writeData(Context context,List<Article> articleList){
  try {
    FileOutputStream fileStream=context.openFileOutput("articles",Context.MODE_PRIVATE);
    ObjectOutputStream writer=new ObjectOutputStream(fileStream);
    writer.writeObject(articleList);
    writer.close();
    fileStream.close();
  }
 catch (  IOException e) {
    Log.e("AARSS","Problem saving file.",e);
    return;
  }
}
 

Example 6

From project Aardvark, under directory /aardvark/src/main/test/gw/vark/it/.

Source file: ForkedAardvarkProcess.java

  49 
vote

@Override protected List<File> createClasspath(){
  try {
    File assemblyDir=ITUtil.getAssemblyDir();
    File libDir=new File(assemblyDir,"lib");
    File launcherJar=ITUtil.findFile(libDir,"gosu-launcher-[\\d\\.]+\\.jar");
    return Collections.singletonList(launcherJar);
  }
 catch (  FileNotFoundException e) {
    throw new RuntimeException(e);
  }
}
 

Example 7

From project accesointeligente, under directory /src/org/accesointeligente/client/presenters/.

Source file: HomePresenter.java

  48 
vote

@Override public void loadLastResponseRequests(){
  requestService.getLastResponseRequests(new AsyncCallback<List<Request>>(){
    @Override public void onFailure(    Throwable caught){
      showNotification("No es posible recuperar el listado solicitado",NotificationEventType.ERROR);
      placeManager.revealDefaultPlace();
    }
    @Override public void onSuccess(    List<Request> results){
      ListDataProvider<Request> data=new ListDataProvider<Request>(results);
      getView().setRequests(data);
    }
  }
);
}
 

Example 8

From project AceWiki, under directory /src/ch/uzh/ifi/attempto/aceeditor/test/.

Source file: ChartParserGenerationTest.java

  44 
vote

private static void completeSentence(){
  if (chartparser.getTokens().size() == 7) {
    if (chartparser.isComplete())     printTokens();
    return;
  }
  List<String> processed=new ArrayList<String>();
  for (  ConcreteOption o : chartparser.getConcreteOptions()) {
    String n=o.getWord();
    if (processed.contains(n))     continue;
    processed.add(n);
    chartparser.addToken(o.getWord());
    completeSentence();
    chartparser.removeToken();
  }
}
 

Example 9

From project Absolute-Android-RSS, under directory /src/com/AA/Other/.

Source file: RSSParse.java

  42 
vote

/** 
 * Get the list of articles currently contained in the RSS feed.
 * @param isBackground if the request is being run in the background
 * @param callingContext current application context
 * @return List of articles contained in the RSS on success. On failure returns null
 */
public static List<Article> getArticles(boolean isBackground,Context callingContext){
  if (!isNetworkAvailable(isBackground,callingContext))   return null;
  Document doc=getDocument();
  if (doc == null)   return null;
  try {
    ArrayList<Article> articles=new ArrayList<Article>();
    NodeList items=doc.getElementsByTagName("item");
    for (int i=0; i < items.getLength(); i++) {
      Element el=(Element)items.item(i);
      String title=el.getElementsByTagName("title").item(0).getFirstChild().getNodeValue();
      String date=el.getElementsByTagName("pubDate").item(0).getFirstChild().getNodeValue();
      String url=el.getElementsByTagName("link").item(0).getFirstChild().getNodeValue();
      String desc=el.getElementsByTagName("description").item(0).getFirstChild().getNodeValue();
      articles.add(new Article(desc,title,date,url));
    }
    return articles;
  }
 catch (  Exception e) {
    Log.e("AARSS","Error Parsing RSS",e);
    return null;
  }
}
 

Example 10

From project acceleo-modules, under directory /ecore-gen-scala/plugins/com.github.sbegaudeau.acceleo.modules.ecore.gen.scala/src/com/github/sbegaudeau/acceleo/modules/ecore/gen/scala/main/.

Source file: EcoreGenScala.java

  42 
vote

/** 
 * This can be used to launch the generation from a standalone application.
 * @param args Arguments of the generation.
 * @generated
 */
public static void main(String[] args){
  try {
    if (args.length < 2) {
      System.out.println("Arguments not valid : {model, folder}.");
    }
 else {
      URI modelURI=URI.createFileURI(args[0]);
      File folder=new File(args[1]);
      List<String> arguments=new ArrayList<String>();
      EcoreGenScala generator=new EcoreGenScala(modelURI,folder,arguments);
      for (int i=2; i < args.length; i++) {
        generator.addPropertiesFile(args[i]);
      }
      generator.doGenerate(new BasicMonitor());
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}
 

Example 11

From project accounted4, under directory /accounted4/stock-quote/stock-quote-yahoo/src/main/java/com/accounted4/stockquote/yahoo/.

Source file: YahooQuoteService.java

  41 
vote

private List<HashMap<QuoteAttribute,String>> processResponse(String response,List<QuoteAttribute> quoteAttributes){
  List<HashMap<QuoteAttribute,String>> result=new ArrayList<>();
  String[] lines=response.split("\n");
  for (  String line : lines) {
    String[] items=line.split(ATTRIBUTE_SEPARATOR);
    HashMap<QuoteAttribute,String> lineItem=new HashMap<>();
    int i=0;
    for (    String item : items) {
      lineItem.put(quoteAttributes.get(i++),item);
    }
    result.add(lineItem);
  }
  return result;
}
 

Example 12

From project 16Blocks, under directory /src/main/java/de/minestar/sixteenblocks/Manager/.

Source file: AreaDatabaseManager.java

  40 
vote

public ArrayList<SkinArea> createNotExistingAreas(){
  List<SkinArea> currentZones=this.loadZones();
  ZoneXZ thisZone;
  int maxRow=Integer.MIN_VALUE;
  for (  SkinArea thisArea : currentZones) {
    thisZone=thisArea.getZoneXZ();
    if (thisZone.getZ() > maxRow)     maxRow=thisZone.getZ();
  }
  ArrayList<SkinArea> newSkins=new ArrayList<SkinArea>();
  for (int row=0; row <= maxRow; row++) {
    System.out.println("Extending row in DB: " + row);
    for (int x=-Settings.getSkinsRight() + (row % 2 == 0 ? 0 : 1); x <= Settings.getSkinsLeft(); x++) {
      if (!this.areaExists(x,row)) {
        SkinArea newArea=new SkinArea(x,row,"");
        this.saveZone(newArea);
        newSkins.add(newArea);
      }
    }
  }
  return newSkins;
}
 

Example 13

From project 16Blocks, under directory /src/main/java/de/minestar/sixteenblocks/Manager/.

Source file: AreaDatabaseManager.java

  39 
vote

public List<SkinArea> loadZones(){
  List<SkinArea> thisList=new LinkedList<SkinArea>();
  try {
    ResultSet result=this.loadAreas.executeQuery();
    while (result.next())     thisList.add(new SkinArea(result.getInt(2),result.getInt(3),result.getString(1)));
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return thisList;
}
 

Example 14

From project acceleo-modules, under directory /psm-gen-scala/plugins/com.github.sbegaudeau.acceleo.modules.psm.gen.scala/src/com/github/sbegaudeau/acceleo/modules/psm/gen/scala/main/.

Source file: Workflow.java

  39 
vote

/** 
 * This can be used to launch the generation from a standalone application.
 * @param args Arguments of the generation.
 * @generated
 */
public static void main(String[] args){
  try {
    if (args.length < 2) {
      System.out.println("Arguments not valid : {model, folder}.");
    }
 else {
      URI modelURI=URI.createFileURI(args[0]);
      File folder=new File(args[1]);
      List<String> arguments=new ArrayList<String>();
      Workflow generator=new Workflow(modelURI,folder,arguments);
      for (int i=2; i < args.length; i++) {
        generator.addPropertiesFile(args[i]);
      }
      generator.doGenerate(new BasicMonitor());
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}
 

Example 15

From project accounted4, under directory /accounted4/stock-quote/stock-quote-yahoo/src/main/java/com/accounted4/stockquote/yahoo/.

Source file: YahooQuoteService.java

  39 
vote

@Override public List<HashMap<QuoteAttribute,String>> executeQuery(List<String> securityList,List<QuoteAttribute> quoteAttributes){
  String tickerList=securityListToString(securityList);
  String attributeList=attributeListToString(quoteAttributes);
  HttpClient httpclient=new DefaultHttpClient();
  String urlString=BASE_URL + "?" + "s="+ tickerList+ "&"+ "f="+ attributeList;
  System.out.println("Query url: " + urlString);
  HttpGet httpGet=new HttpGet(urlString);
  try {
    HttpResponse response=httpclient.execute(httpGet);
    HttpEntity entity=response.getEntity();
    if (entity != null) {
      String stringResponse=EntityUtils.toString(entity);
      return processResponse(stringResponse,quoteAttributes);
    }
  }
 catch (  IOException ex) {
    System.out.println("Error " + ex);
  }
  List<HashMap<QuoteAttribute,String>> result=new ArrayList<>();
  return result;
}
 

Example 16

From project AceWiki, under directory /src/ch/uzh/ifi/attempto/aceeditor/.

Source file: ACEEditorMenuCreator.java

  39 
vote

public List<SpecialMenuItem> createSpecialMenuItems(NextTokenOptions options){
  List<SpecialMenuItem> items=new ArrayList<SpecialMenuItem>();
  Map<String,String> m=new HashMap<String,String>();
  for (  String s : extCats) {
    if (options.containsCategory(s)) {
      String menuGroup=cats.get(s);
      if (m.containsKey(menuGroup)) {
        m.put(menuGroup,m.get(menuGroup) + s + ":");
      }
 else {
        m.put(menuGroup,"new:" + s + ":");
      }
    }
  }
  if (!editor.isLexiconImmutable()) {
    for (    String menuGroup : m.keySet()) {
      items.add(new SpecialMenuItem("new...",menuGroup,m.get(menuGroup),this));
    }
  }
  return items;
}
 

Example 17

From project acceleo-webapp-generator, under directory /plugins/org.eclipse.acceleo.tutorial.extension/src/org/eclipse/acceleo/tutorial/extension/main/.

Source file: Extension.java

  38 
vote

/** 
 * This can be used to launch the generation from a standalone application.
 * @param args Arguments of the generation.
 * @generated
 */
public static void main(String[] args){
  try {
    if (args.length < 2) {
      System.out.println("Arguments not valid : {model, folder}.");
    }
 else {
      URI modelURI=URI.createFileURI(args[0]);
      File folder=new File(args[1]);
      List<String> arguments=new ArrayList<String>();
      Extension generator=new Extension(modelURI,folder,arguments);
      for (int i=2; i < args.length; i++) {
        generator.addPropertiesFile(args[i]);
      }
      generator.doGenerate(new BasicMonitor());
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}
 

Example 18

From project acceleo-webapp-generator, under directory /plugins/org.eclipse.acceleo.tutorial.extension/src/org/eclipse/acceleo/tutorial/extension/main/.

Source file: Extension.java

  38 
vote

/** 
 * If the module(s) called by this launcher require properties files, return their qualified path from here.Take note that the first added properties files will take precedence over subsequent ones if they contain conflicting keys.
 * @return The list of properties file we need to add to the generation context.
 * @see java.util.ResourceBundle#getBundle(String)
 * @generated not
 */
@Override public List<String> getProperties(){
  propertiesFiles.add("platform:/plugin/org.eclipse.acceleo.tutorial.webapp/org/eclipse/acceleo/tutorial/webapp/properties/default.properties");
  if (EMFPlugin.IS_ECLIPSE_RUNNING && model != null && model.eResource() != null) {
    propertiesFiles.addAll(AcceleoEngineUtils.getPropertiesFilesNearModel(model.eResource()));
  }
  return propertiesFiles;
}
 

Example 19

From project accent, under directory /src/main/java/net/lshift/accent/.

Source file: AccentConfirmPublisher.java

  38 
vote

private void applyResult(FeedbackResult result,long seqNo,boolean multiple){
synchronized (waiting) {
    List<FeedbackHandle> toRemove=new ArrayList<FeedbackHandle>();
    for (    FeedbackHandle handle : waiting) {
      if (handle.ackApplies(seqNo,multiple)) {
        handle.setResult(result);
        toRemove.add(handle);
      }
    }
    waiting.removeAll(toRemove);
  }
}
 

Example 20

From project accesointeligente, under directory /src/org/accesointeligente/client/presenters/.

Source file: RequestResponsePresenter.java

  38 
vote

@Override public void loadComments(Request request){
  requestService.getRequestComments(request,new AsyncCallback<List<RequestComment>>(){
    @Override public void onFailure(    Throwable caught){
      showNotification("No es posible recuperar los archivos adjuntos",NotificationEventType.ERROR);
      placeManager.navigateBack();
    }
    @Override public void onSuccess(    List<RequestComment> comments){
      getView().setComments(comments);
    }
  }
);
}
 

Example 21

From project 4308Cirrus, under directory /Extras/actionbarsherlock/src/com/actionbarsherlock/internal/view/menu/.

Source file: ActionMenu.java

  37 
vote

public int addIntentOptions(int groupId,int itemId,int order,ComponentName caller,Intent[] specifics,Intent intent,int flags,MenuItem[] outSpecificItems){
  PackageManager pm=mContext.getPackageManager();
  final List<ResolveInfo> lri=pm.queryIntentActivityOptions(caller,specifics,intent,0);
  final int N=lri != null ? lri.size() : 0;
  if ((flags & FLAG_APPEND_TO_GROUP) == 0) {
    removeGroup(groupId);
  }
  for (int i=0; i < N; i++) {
    final ResolveInfo ri=lri.get(i);
    Intent rintent=new Intent(ri.specificIndex < 0 ? intent : specifics[ri.specificIndex]);
    rintent.setComponent(new ComponentName(ri.activityInfo.applicationInfo.packageName,ri.activityInfo.name));
    final MenuItem item=add(groupId,itemId,order,ri.loadLabel(pm)).setIcon(ri.loadIcon(pm)).setIntent(rintent);
    if (outSpecificItems != null && ri.specificIndex >= 0) {
      outSpecificItems[ri.specificIndex]=item;
    }
  }
  return N;
}