当前位置: 首页>>代码示例>>Java>>正文


Java ArrayList.isEmpty方法代码示例

本文整理汇总了Java中java.util.ArrayList.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayList.isEmpty方法的具体用法?Java ArrayList.isEmpty怎么用?Java ArrayList.isEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.ArrayList的用法示例。


在下文中一共展示了ArrayList.isEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testCoverage

import java.util.ArrayList; //导入方法依赖的package包/类
protected void testCoverage( Class extensionClass ) {
  Method[] methods = extensionClass.getMethods();
  ArrayList<String> untested = new ArrayList<>();
  for (Method m : methods) {
    if (Modifier.isStatic(m.getModifiers()) && !Modifier.isPrivate(m.getModifiers())) {
      try {
        String name = m.getName();
        getClass().getMethod("test" + Character.toUpperCase(name.charAt(0)) + name.substring(1));
      } catch (Exception e) {
        String fullDesc = m.toString();
        untested.add( "Untested: " + fullDesc.substring( fullDesc.indexOf( '.' + m.getName() + '(' ) + 1 ) );
      }
    }
  }
  if (!untested.isEmpty()) {
    StringBuilder msg = new StringBuilder();
    untested.stream().sorted().forEach(e -> msg.append(e).append("\n"));
    msg.append("Expecting at least one test method per extension method of the form: testXxx().\n");
    TestCase.fail( msg.toString());
  }
}
 
开发者ID:manifold-systems,项目名称:manifold,代码行数:22,代码来源:ExtensionManifoldTest.java

示例2: interpretTime

import java.util.ArrayList; //导入方法依赖的package包/类
private static ArrayList<Integer> interpretTime(String[] commands) throws InvalidDisplayOptionException{
  int indice = 0;
  ArrayList<Integer> actions = new ArrayList<Integer>(3);
  for(String command : commands){
    if (command.contains(Main.SINGLECOLUM) || command.contains(Main.DOUBLECOLUM) || command.contains(Main.TRIPLECOLUM))
      ;
    else if(command.contains(Main.INDICATIVO))
      actions.add(1);
    else if(command.contains(Main.CONJUNTIVO))
      actions.add(2);
    else if(command.contains(Main.IMPERATIVO))
      actions.add(3);
    else
      throw new InvalidDisplayOptionException(command);
  }
  if (actions.isEmpty()) {
    actions.add(1);
    actions.add(2);
    actions.add(3);
  }
  return actions;
}
 
开发者ID:Jonathas-Conceicao,项目名称:Conjuga-Me-Java,代码行数:23,代码来源:Main.java

示例3: getCreateEvents

import java.util.ArrayList; //导入方法依赖的package包/类
public List getCreateEvents() {
  if (this.events == null) {
    return Collections.EMPTY_LIST;
  } else {
    ArrayList result = new ArrayList(this.events.size());
    Iterator it = this.events.iterator();
    while (it.hasNext()) {
      CacheEvent ce = (CacheEvent) it.next();
      if (ce.getOperation().isCreate() && isEventUserVisible(ce)) {
        result.add(ce);
      }
    }
    if (result.isEmpty()) {
      return Collections.EMPTY_LIST;
    } else {
      return Collections.unmodifiableList(result);
    }
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:20,代码来源:TXRmtEvent.java

示例4: queryContentProviders

import java.util.ArrayList; //导入方法依赖的package包/类
@Override
public VParceledListSlice<ProviderInfo> queryContentProviders(String processName, int vuid, int flags) {
    int userId = VUserHandle.getUserId(vuid);
    checkUserId(userId);
    flags = updateFlagsNought(flags);
    ArrayList<ProviderInfo> finalList = new ArrayList<>(3);
    // reader
    synchronized (mPackages) {
        for (VPackage.ProviderComponent p : mProvidersByComponent.values()) {
            PackageSetting ps = (PackageSetting) p.owner.mExtras;
            if (processName == null || ps.appId == VUserHandle.getAppId(vuid) && p.info.processName.equals(processName)) {
                ProviderInfo providerInfo = PackageParserEx.generateProviderInfo(p, flags, ps.readUserState(userId), userId);
                finalList.add(providerInfo);
            }
        }
    }
    if (!finalList.isEmpty()) {
        Collections.sort(finalList, sProviderInitOrderSorter);
    }
    return new VParceledListSlice<>(finalList);
}
 
开发者ID:coding-dream,项目名称:TPlayer,代码行数:22,代码来源:VPackageManagerService.java

示例5: refreshList

import java.util.ArrayList; //导入方法依赖的package包/类
public boolean refreshList() throws DataSourceException {
    ArrayList<Produto> result = ServicoProduto.procurarProduto(ultimaPesquisa);        

    DefaultTableModel model = (DefaultTableModel) jtConsultar.getModel();

    model.setRowCount(0);
    
    if (result == null || result.isEmpty()) {
        return false;
    }

    for (int i = 0; i < result.size(); i++) {
        Produto p = result.get(i);
        if (p != null) {
            Object[] row = new Object[6];
            row[0] = p.getId();
            row[1] = p.getNome();
            row[2] = p.getCategoria();
            row[3] = p.getValorCompra();
            row[4] = p.getValorVenda();
            row[5] = p.getDtCadastro();
            model.addRow(row);
        }
    }
    return true;
}
 
开发者ID:OgumaJr,项目名称:Entrega-Final,代码行数:27,代码来源:Principal.java

示例6: checkCrossUser

import java.util.ArrayList; //导入方法依赖的package包/类
private boolean checkCrossUser() {
    Uri uri;
    if (getIntent().getAction().equals(Intent.ACTION_SEND)) {
        uri = getIntent().getParcelableExtra(Intent.EXTRA_STREAM);
    } else {
        ArrayList<Uri> uris = getIntent().getParcelableArrayListExtra(Intent.EXTRA_STREAM);
        uri = uris.isEmpty() ? null : uris.get(0);
    }

    if (uri != null && uri.getScheme().equals("file")) {
        String path = uri.getPath();
        if (!path.startsWith(Environment.getExternalStorageDirectory().getAbsolutePath())) {
            return false;
        }
    }
    return true;
}
 
开发者ID:RikkaW,项目名称:Bridge,代码行数:18,代码来源:SaveActivity.java

示例7: removeLoadingFileObserver

import java.util.ArrayList; //导入方法依赖的package包/类
public void removeLoadingFileObserver(FileDownloadProgressListener observer) {
    if (listenerInProgress) {
        deleteLaterArray.add(observer);
        return;
    }
    String fileName = observersByTag.get(observer.getObserverTag());
    if (fileName != null) {
        ArrayList<WeakReference<FileDownloadProgressListener>> arrayList = loadingFileObservers
                .get(fileName);
        if (arrayList != null) {
            for (int a = 0; a < arrayList.size(); a++) {
                WeakReference<FileDownloadProgressListener> reference = arrayList.get(a);
                if (reference.get() == null || reference.get() == observer) {
                    arrayList.remove(a);
                    a--;
                }
            }
            if (arrayList.isEmpty()) {
                loadingFileObservers.remove(fileName);
            }
        }
        observersByTag.remove(observer.getObserverTag());
    }
}
 
开发者ID:chengzichen,项目名称:KrGallery,代码行数:25,代码来源:MediaController.java

示例8: getRecycledView

import java.util.ArrayList; //导入方法依赖的package包/类
public ViewHolder getRecycledView(int viewType) {
    final ArrayList<ViewHolder> scrapHeap = mScrap.get(viewType);
    if (scrapHeap != null && !scrapHeap.isEmpty()) {
        final int index = scrapHeap.size() - 1;
        final ViewHolder scrap = scrapHeap.get(index);
        scrapHeap.remove(index);
        return scrap;
    }
    return null;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:11,代码来源:RecyclerView.java

示例9: toArgumentList

import java.util.ArrayList; //导入方法依赖的package包/类
protected String toArgumentList(ArrayList<String> list) {
	if(list == null || list.isEmpty()) return null;
	String argList = "";
	if(list.size() == 1) return list.get(0);
	else {
		argList += "(" + list.get(0);
		for (int i=1; i<list.size(); i++) {
			argList += ", " + list.get(i);
		}
		argList += ")";
	}
	return argList;
}
 
开发者ID:aschaetzle,项目名称:Sempala,代码行数:14,代码来源:ImpalaBase.java

示例10: findAttributes

import java.util.ArrayList; //导入方法依赖的package包/类
private AttributeSet findAttributes() {
    ArrayList<AttributeSet> list = new ArrayList<AttributeSet>();

    for(int i = 0; i < marks.length; i++) {
        if (marks[i].getPreviousMarkAttributes() != null) {
            list.add(marks[i].getPreviousMarkAttributes());
        }
    }

    if (!list.isEmpty()) {
        return AttributesUtilities.createComposite(list.toArray(new AttributeSet[list.size()]));
    } else {
        return null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:ProxyHighlightsContainer.java

示例11: readColumnInfoViaReflection

import java.util.ArrayList; //导入方法依赖的package包/类
private ColumnMapping readColumnInfoViaReflection(Class<?> clazz) {
    Field[] fieldArray = clazz.getDeclaredFields();
    ArrayList<ColumnInfo> list = new ArrayList<>(fieldArray.length);
    ColumnInfo rowNumberColumn = null;
    for (Field field: fieldArray) {

        RowNumber rowNumberAnnotation = field.getAnnotation(RowNumber.class);

        if (! Objects.isNull(rowNumberAnnotation)) {
            rowNumberColumn = new ColumnInfo("__id__", field.getName(), -1, null,Integer.class, NoopConverter.class);
            continue;
        }

        Column annotation = field.getAnnotation(Column.class);
        if (! Objects.isNull(annotation)) {
            Class<?> converter = annotation.convertorClass();
            list.add(new ColumnInfo(annotation.name().trim(),
                    field.getName(),
                    annotation.index(),
                    annotation.dataFormat(),
                    field.getType(),
                    converter));
        }
    }

    if (list.isEmpty()) {
        throw new ZeroCellException(String.format("Class %s does not have @Column annotations", clazz.getName()));
    }
    list.trimToSize();
    return new ColumnMapping(rowNumberColumn, list);
}
 
开发者ID:creditdatamw,项目名称:zerocell,代码行数:32,代码来源:EntityHandler.java

示例12: classListToJsonArray

import java.util.ArrayList; //导入方法依赖的package包/类
/**
 * Convert an ArrayList of classes to a JSON array.
 *
 * @param classes ArrayList
 * @return JSONArray
 */
public static JSONArray classListToJsonArray(ArrayList<Class> classes) {
    if (classes == null || classes.isEmpty()) return new JSONArray();
    JSONArray json = new JSONArray();

    try {
        for (Class cls : classes) {
            JSONObject obj = new JSONObject();
            JSONArray tutors = new JSONArray();

            for (String tutor : cls.getTutors())
                tutors.put(tutor);

            obj.put("id", cls.getId());
            obj.put("lokaal", cls.getLocation());
            obj.put("starttijd", cls.getTimeStart().getTime());
            obj.put("eindtijd", cls.getTimeEnd().getTime());
            obj.put("commentaar", cls.getComments());
            obj.put("groepcode", cls.getGroups());
            obj.put("vakcode", cls.getClassName());
            obj.put("docentnamen", tutors);

            json.put(obj);
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }

    return json;
}
 
开发者ID:linklux,项目名称:android-schedules,代码行数:36,代码来源:JSONUtil.java

示例13: PlatformPageAdapter

import java.util.ArrayList; //导入方法依赖的package包/类
public PlatformPageAdapter(PlatformPage page, ArrayList<Object> cells) {
	this.page = page;
	if (cells != null && !cells.isEmpty()) {
		calculateSize(page.getContext(), cells);
		collectCells(cells);
	}
}
 
开发者ID:GitLqr,项目名称:LQRWeChat,代码行数:8,代码来源:PlatformPageAdapter.java

示例14: onLoadFinished

import java.util.ArrayList; //导入方法依赖的package包/类
@Override
public void onLoadFinished(Loader<ArrayList<Quake>> loader, ArrayList<Quake> earthquakes) {
    emptyView.setText(R.string.emptyText);
    emptyDesc.setText(R.string.emptyview_desc);
    mySwipeRefreshLayout.setRefreshing(false);
    emptyImageView.setImageResource(R.drawable.happy_earth);
    if (earthquakes != null && !earthquakes.isEmpty()) {
        updateUi(earthquakes);
        emptyImageView.setVisibility(View.GONE);
        emptyView.setVisibility(View.GONE);
    }
    progressBar.setVisibility(View.GONE);
}
 
开发者ID:rahul051296,项目名称:quake-alert-android-app,代码行数:14,代码来源:QuakeActivity.java

示例15: isValidInput

import java.util.ArrayList; //导入方法依赖的package包/类
public boolean isValidInput(List<ItemStack> ground, boolean circles) {
	ArrayList<ItemStack> checklist = new ArrayList<ItemStack>(ground.size());
	for (ItemStack item : ground)
		for (int j = 0; j < item.getCount(); j++) {
			ItemStack copy = item.copy();
			copy.setCount(1);
			checklist.add(copy);
		}

	if (checklist.size() != input.size()) {
		return false;
	}
	ArrayList<Ingredient> removalList = new ArrayList<Ingredient>(input);

	for (ItemStack stack_on_ground : checklist) {
		Ingredient found = null;
		for (Ingredient ingredient : removalList) {
			if (ingredient.apply(stack_on_ground)) {
				found = ingredient;
				break;
			}
		}
		if (found == null) {
			return false; //The stack on the ground doesn't belong to the rite
		}
		removalList.remove(found);
	}
	if (!removalList.isEmpty()) {
		return false;
	}
	return circles;
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:33,代码来源:Ritual.java


注:本文中的java.util.ArrayList.isEmpty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。