Java Collections.emptyList Examples

Java Collections.emptyList - 30 examples found. These are the top rated real world Java examples of java.util.Collections.emptyList extracted from open source projects. You can rate examples to help us improve the quality of examples.
 protected boolean sortInfoChanged(List<SortInfo> oldSortInfos, List<SortInfo> newSortInfos) {
   if (oldSortInfos == null && newSortInfos == null) {
     return false;
   } else if (oldSortInfos == null) {
     oldSortInfos = Collections.emptyList();
   } else if (newSortInfos == null) {
     newSortInfos = Collections.emptyList();
   }
   if (oldSortInfos.size() != newSortInfos.size()) {
     return true;
   }
   for (int i = 0; i < oldSortInfos.size(); i++) {
     SortInfo oldSort = oldSortInfos.get(i);
     SortInfo newSort = newSortInfos.get(i);
     if (oldSort == null && newSort == null) {
       continue;
     } else if (oldSort == null || newSort == null) {
       return true;
     }
     if (!oldSort.equals(newSort)) {
       return true;
     }
   }
   return false;
 }
  /**
   * Returns the {@link AccessibilityServiceInfo}s of the enabled accessibility services for a given
   * feedback type.
   *
   * @param feedbackTypeFlags The feedback type flags.
   * @return An unmodifiable list with {@link AccessibilityServiceInfo}s.
   * @see AccessibilityServiceInfo#FEEDBACK_AUDIBLE
   * @see AccessibilityServiceInfo#FEEDBACK_GENERIC
   * @see AccessibilityServiceInfo#FEEDBACK_HAPTIC
   * @see AccessibilityServiceInfo#FEEDBACK_SPOKEN
   * @see AccessibilityServiceInfo#FEEDBACK_VISUAL
   * @see AccessibilityServiceInfo#FEEDBACK_BRAILLE
   */
  public List<AccessibilityServiceInfo> getEnabledAccessibilityServiceList(int feedbackTypeFlags) {
    final IAccessibilityManager service;
    final int userId;
    synchronized (mLock) {
      service = getServiceLocked();
      if (service == null) {
        return Collections.emptyList();
      }
      userId = mUserId;
    }

    List<AccessibilityServiceInfo> services = null;
    try {
      services = service.getEnabledAccessibilityServiceList(feedbackTypeFlags, userId);
      if (DEBUG) {
        Log.i(LOG_TAG, "Installed AccessibilityServices " + services);
      }
    } catch (RemoteException re) {
      Log.e(LOG_TAG, "Error while obtaining the installed AccessibilityServices. ", re);
    }
    if (services != null) {
      return Collections.unmodifiableList(services);
    } else {
      return Collections.emptyList();
    }
  }
  private MethodDeclaration createOptionSetter(PropertyDeclaration property) {
    assert property != null;
    SimpleName paramName = context.createVariableName("option"); // $NON-NLS-1$

    Type optionType = context.getFieldType(property);
    return f.newMethodDeclaration(
        new JavadocBuilder(f)
            .text(
                Messages.getString("ProjectiveModelEmitter.javadocOptionSetter"), // $NON-NLS-1$
                context.getDescription(property))
            .param(paramName)
            .text(
                Messages.getString(
                    "ProjectiveModelEmitter.javadocOptionSetterParameter"), //$NON-NLS-1$
                context.getDescription(property))
            .toJavadoc(),
        new AttributeBuilder(f).toAttributes(),
        Collections.emptyList(),
        context.resolve(void.class),
        context.getOptionSetterName(property),
        Arrays.asList(
            new FormalParameterDeclaration[] {
              f.newFormalParameterDeclaration(optionType, paramName)
            }),
        0,
        Collections.emptyList(),
        null);
  }
Example #4
0
    private void materializeResults(Results r, boolean startOver) throws IOException {
      if (driver.getPlan().getFetchTask() == null) {
        // This query is never going to return anything.
        r.has_more = false;
        r.setData(Collections.<String>emptyList());
        r.setColumns(Collections.<String>emptyList());
        return;
      }

      if (startOver) {
        // This is totally inappropriately reaching into internals.
        driver.getPlan().getFetchTask().initialize(hiveConf, driver.getPlan(), null);
        startRow = 0;
      }

      ArrayList<String> v = new ArrayList<String>();
      r.setData(v);
      r.has_more = driver.getResults(v);
      r.start_row = startRow;
      startRow += v.size();

      r.setColumns(new ArrayList<String>());
      try {
        for (FieldSchema f : driver.getSchema().getFieldSchemas()) {
          r.addToColumns(f.getName());
        }
      } catch (Exception e) {
        // An empty partitioned table may not have table description
        LOG.error("Error getting column names of results.", e);
      }
    }
Example #5
0
 public CaseStageInstanceImpl(String id, String name) {
   this.id = id;
   this.name = name;
   this.adHocFragments = Collections.emptyList();
   this.activeNodes = Collections.emptyList();
   this.status = StageStatus.Active;
 }
 public static List<Event> delta(
     File baseDirectory, List<File> created, List<File> removed, List<File> modified) {
   if (created == null) {
     created = Collections.emptyList();
   }
   if (removed == null) {
     removed = Collections.emptyList();
   }
   if (modified == null) {
     modified = Collections.emptyList();
   }
   int size = created.size() + removed.size() + modified.size();
   if (size == 0) {
     return null;
   }
   List<Event> delta = new ArrayList<Event>(size);
   for (File file : created) {
     String newPath = Paths.convert(baseDirectory, file);
     delta.add(new Event(newPath, Kind.ENTRY_CREATE));
   }
   for (File file : removed) {
     String deletePath = Paths.convert(baseDirectory, file);
     delta.add(new Event(deletePath, Kind.ENTRY_DELETE));
   }
   for (File file : modified) {
     String changedPath = Paths.convert(baseDirectory, file);
     delta.add(new Event(changedPath, Kind.ENTRY_MODIFY));
   }
   return delta;
 }