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


Java ArrayList类代码示例

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


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

示例1: I18nField

import java.util.ArrayList; //导入依赖的package包/类
/**
 * Constructeur, initialisation du champs
 * @param listeLangueEnService 
 * @param langueParDefaut 
 * @param libelleBtnPlus 
 */
public I18nField(Langue langueParDefaut, List<Langue> listeLangueEnService, String libelleBtnPlus) {
	super();
	setRequired(false);			
	this.langueParDefaut = langueParDefaut;
	this.listeLangueEnService = listeLangueEnService;
	
	listLayoutTraductions = new ArrayList<HorizontalLayout>();
	listeTraduction = new ArrayList<I18nTraduction>();
	layoutComplet = new VerticalLayout();
	layoutComplet.setSpacing(true);
	layoutLangue = new VerticalLayout();
	layoutLangue.setSpacing(true);
	layoutComplet.addComponent(layoutLangue);
	
	btnAddLangue = new OneClickButton(libelleBtnPlus,FontAwesome.PLUS_SQUARE_O);
	btnAddLangue.setVisible(false);
	btnAddLangue.addStyleName(ValoTheme.BUTTON_TINY);
	layoutComplet.addComponent(btnAddLangue);
	btnAddLangue.addClickListener(e->{
		layoutLangue.addComponent(getLangueLayout(null));
		checkVisibleAddLangue();
		centerWindow();
	});		
}
 
开发者ID:EsupPortail,项目名称:esup-ecandidat,代码行数:31,代码来源:I18nField.java

示例2: testGetStoppedWebServersAndJvmsCount

import java.util.ArrayList; //导入依赖的package包/类
@Test
public void testGetStoppedWebServersAndJvmsCount() {
    when(mockGroupService.getGroups()).thenReturn(new ArrayList<>(groups));
    when(mockJvmService.getJvmStoppedCount(anyString())).thenReturn(0L);
    when(mockJvmService.getJvmForciblyStoppedCount(anyString())).thenReturn(0L);
    when(mockJvmService.getJvmCount(anyString())).thenReturn(1L);
    when(mockWebServerService.getWebServerStoppedCount(anyString())).thenReturn(0L);
    when(mockWebServerService.getWebServerCount(anyString())).thenReturn(1L);

    Response response = groupServiceRest.getStoppedWebServersAndJvmsCount();
    assertNotNull(response);

    response = groupServiceRest.getStoppedWebServersAndJvmsCount("testGroup");
    assertNotNull(response);

}
 
开发者ID:cerner,项目名称:jwala,代码行数:17,代码来源:GroupServiceRestImplTest.java

示例3: main

import java.util.ArrayList; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    out.println(VM.current().details());

    ArrayList<Integer> al = new ArrayList<Integer>();
    LinkedList<Integer> ll = new LinkedList<Integer>();

    for (int i = 0; i < 1000; i++) {
        Integer io = i; // box once
        al.add(io);
        ll.add(io);
    }

    al.trimToSize();

    PrintWriter pw = new PrintWriter(out);
    pw.println(GraphLayout.parseInstance(al).toFootprint());
    pw.println(GraphLayout.parseInstance(ll).toFootprint());
    pw.println(GraphLayout.parseInstance(al, ll).toFootprint());
    pw.close();
}
 
开发者ID:tianshuang,项目名称:jol-samples,代码行数:21,代码来源:JOLSample_16_AL_LL.java

示例4: decode

import java.util.ArrayList; //导入依赖的package包/类
@Override
protected Mp4WebvttSubtitle decode(byte[] bytes, int length, boolean reset)
    throws SubtitleDecoderException {
  // Webvtt in Mp4 samples have boxes inside of them, so we have to do a traditional box parsing:
  // first 4 bytes size and then 4 bytes type.
  sampleData.reset(bytes, length);
  List<Cue> resultingCueList = new ArrayList<>();
  while (sampleData.bytesLeft() > 0) {
    if (sampleData.bytesLeft() < BOX_HEADER_SIZE) {
      throw new SubtitleDecoderException("Incomplete Mp4Webvtt Top Level box header found.");
    }
    int boxSize = sampleData.readInt();
    int boxType = sampleData.readInt();
    if (boxType == TYPE_vttc) {
      resultingCueList.add(parseVttCueBox(sampleData, builder, boxSize - BOX_HEADER_SIZE));
    } else {
      // Peers of the VTTCueBox are still not supported and are skipped.
      sampleData.skipBytes(boxSize - BOX_HEADER_SIZE);
    }
  }
  return new Mp4WebvttSubtitle(resultingCueList);
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:23,代码来源:Mp4WebvttDecoder.java

示例5: initMcrmbCore

import java.util.ArrayList; //导入依赖的package包/类
public static void initMcrmbCore() {
    commentedConfig = ConfigManager.get().getConfig();
    config.sid = commentedConfig.getNode("sid").getString();
    if (config.sid.equalsIgnoreCase("null")) {
        config.sid = null;
    }
    config.key = commentedConfig.getNode("key").getString();
    if (config.key.equalsIgnoreCase("null")) {
        config.key = null;
    }

    config.logApi = commentedConfig.getNode("logApi").getBoolean();
    config.renewOnJoin = commentedConfig.getNode("renewOnJoin").getBoolean();
    config.opModifyWhiteList = new ArrayList<>();
    try {
        config.opModifyWhiteList.addAll(commentedConfig.getNode("opModifyWhiteList").getList(TypeToken.of(String.class)));
    } catch (ObjectMappingException e) {
    }
    config.point = commentedConfig.getNode("point").getString().replace("&", "§");
    config.prefix = commentedConfig.getNode("prefix").getString().replace("&", "§");
    config.command = commentedConfig.getNode("command").getString();

}
 
开发者ID:txgs888,项目名称:McrmbCore_Sponge,代码行数:24,代码来源:McrmbPluginInfo.java

示例6: getAllAncestors

import java.util.ArrayList; //导入依赖的package包/类
protected static List<File> getAllAncestors(File base, File file) {
    List<File> files = new ArrayList<>();
    if (file != null) {
        boolean stop = false;
        file = file.getParentFile();
        while (!stop) {
            if (file == null || !file.toPath().startsWith(base.toPath())) {
                stop = true;
            } else {
                files.add(file);
                file = file.getParentFile();
            }
        }
    }
    return files;
}
 
开发者ID:HewlettPackard,项目名称:loom,代码行数:17,代码来源:FileUtils.java

示例7: testisSupertypeOf_wildcardType_upperBoundMatch

import java.util.ArrayList; //导入依赖的package包/类
public <N1 extends Number, N2 extends Number, N11 extends N1>
    void testisSupertypeOf_wildcardType_upperBoundMatch() {
  // ? extends T
  assertAssignable(new TypeToken<List<N11>>() {},
      new TypeToken<List<? extends N1>>() {});
  assertNotAssignable(new TypeToken<List<N1>>() {},
      new TypeToken<List<? extends N11>>() {});
  assertNotAssignable(new TypeToken<List<Number>>() {},
      new TypeToken<List<? extends N11>>() {});

  // ? extends Number
  assertAssignable(new TypeToken<List<N1>>() {},
      new TypeToken<List<? extends Number>>() {});
  assertAssignable(new TypeToken<ArrayList<N1>>() {},
      new TypeToken<List<? extends Number>>() {});
  assertAssignable(new TypeToken<List<? extends N11>>() {},
      new TypeToken<List<? extends Number>>() {});
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:19,代码来源:TypeTokenTest.java

示例8: execute

import java.util.ArrayList; //导入依赖的package包/类
public String execute() throws IOException {
    UserEntity user = (UserEntity) httpSession.get("userEntity");
    String pwd = httpServletRequest.getParameter("pwd");
    if (pwd == null || pwd.isEmpty()) {
        pwd = folderRepository.getUserRootFolder(user.getUsername(), user.getId()).getId();
    }

    for (int i = 0; i < file.length; i++) {
        FileEntity fileEntity = new FileEntity();
        fileEntity.setOwnerId(user.getId());
        fileEntity.setFilename(fileFileName[i]);
        fileEntity.setContentType(fileContentType[i]);
        fileEntity = boxService.upload(fileEntity, file[i]);

        System.out.println("1 " + pwd);
        FolderEntity folder = folderRepository.findById(pwd);
        System.out.println("2 " + folder);
        List<String> files = (folder.getFiles() == null) ? new ArrayList<>() : folder.getFiles();
        files.add(fileEntity.getId());
        folder.setFiles(files);
        folderRepository.save(folder);
    }
    return SUCCESS;
}
 
开发者ID:0x603,项目名称:SixBox,代码行数:25,代码来源:UploadFile.java

示例9: parseIdentities

import java.util.ArrayList; //导入依赖的package包/类
private static List<ImportedIdentity> parseIdentities(XmlPullParser xpp)
        throws XmlPullParserException, IOException {
    List<ImportedIdentity> identities = null;

    int eventType = xpp.next();
    while (!(eventType == XmlPullParser.END_TAG && SettingsExporter.IDENTITIES_ELEMENT.equals(xpp.getName()))) {
        if (eventType == XmlPullParser.START_TAG) {
            String element = xpp.getName();
            if (SettingsExporter.IDENTITY_ELEMENT.equals(element)) {
                if (identities == null) {
                    identities = new ArrayList<>();
                }

                ImportedIdentity identity = parseIdentity(xpp);
                identities.add(identity);
            } else {
                Timber.w("Unexpected start tag: %s", xpp.getName());
            }
        }
        eventType = xpp.next();
    }

    return identities;
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:25,代码来源:SettingsImporter.java

示例10: recommendations

import java.util.ArrayList; //导入依赖的package包/类
@Override
public String recommendations() {
	List<Metric> metrics = data.entrySet().stream()
			.map(entry -> entry.getValue().entrySet().stream()
					.map(data -> new Metric(entry.getKey(), data.getKey(), data.getValue()))
					.collect(Collectors.toList()))
			.collect(ArrayList::new, List::addAll, List::addAll);

	Map<String, List<Metric>> runaways = new HashMap<>();
	metrics.stream().collect(Collectors.groupingBy(Metric::name)).entrySet().forEach(entry -> {
		LongSummaryStatistics statistics = entry.getValue().stream()
				.collect(Collectors.summarizingLong(Metric::value));
		runaways.put(entry.getKey(),
				entry.getValue().stream().filter(metric -> metric.value() <= statistics.getAverage())
						.sorted((m1, m2) -> (int) (m1.value() - m2.value())).collect(Collectors.toList()));
	});

	return this.buildRunaways(runaways);
}
 
开发者ID:ludovicianul,项目名称:xray,代码行数:20,代码来源:RunawayReport.java

示例11: addOnTextSizeChangeListener

import java.util.ArrayList; //导入依赖的package包/类
/**
 * Adds an {@link OnTextSizeChangeListener} to the list of those whose methods are called
 * whenever the {@link TextView}'s {@code textSize} changes.
 */
public AutofitHelper addOnTextSizeChangeListener(OnTextSizeChangeListener listener) {
    if (mListeners == null) {
        mListeners = new ArrayList<OnTextSizeChangeListener>();
    }
    mListeners.add(listener);
    return this;
}
 
开发者ID:WrapOnly,项目名称:android-autofittextview,代码行数:12,代码来源:AutofitHelper.java

示例12: testEncoding

import java.util.ArrayList; //导入依赖的package包/类
@Test
public void testEncoding() throws ComponentInitializationException, AttributeEncodingException {
    init();
    IdPAttribute attribute = new IdPAttribute("test");
    List<ScopedStringAttributeValue> stringAttributeValues = new ArrayList<ScopedStringAttributeValue>();
    stringAttributeValues.add(new ScopedStringAttributeValue("value1", "scope"));
    stringAttributeValues.add(new ScopedStringAttributeValue("value2", "scope"));
    attribute.setValues(stringAttributeValues);
    JSONObject object = encoder.encode(attribute);
    Assert.assertTrue(((String) object.get("attributeName")).split(" ")[0].equals("[email protected]"));
    Assert.assertTrue(((String) object.get("attributeName")).split(" ")[1].equals("[email protected]"));
    Assert.assertTrue(((String) object.get("attributeName")).split(" ").length == 2);
    encoder.setScopeDelimiter(":");
    encoder.setStringDelimiter(";");
    object = encoder.encode(attribute);
    Assert.assertTrue(((String) object.get("attributeName")).split(";")[0].equals("value1:scope"));
    Assert.assertTrue(((String) object.get("attributeName")).split(";")[1].equals("value2:scope"));
    Assert.assertTrue(((String) object.get("attributeName")).split(";").length == 2);
}
 
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:20,代码来源:OIDCScopedStringAttributeEncoderTest.java

示例13: testGetMarketplacesForService

import java.util.ArrayList; //导入依赖的package包/类
@Test
public void testGetMarketplacesForService() throws Exception {
    returnedCatalogEntries = new ArrayList<VOCatalogEntry>();
    returnedCatalogEntries.add(localMarketplaceCE);
    returnedCatalogEntries.add(globalMarketplaceCE);
    VOService service = new VOService();

    List<VOCatalogEntry> catalogEntries = bean
            .getMarketplacesForService(service);

    Assert.assertEquals(service, passedService);
    Assert.assertTrue(serviceCalled);
    Assert.assertEquals(2, catalogEntries.size());
    Assert.assertEquals(localMarketplaceCE.getMarketplace()
            .getMarketplaceId(), catalogEntries.get(0).getMarketplace()
            .getMarketplaceId());
    Assert.assertEquals(globalMarketplaceCE.getMarketplace()
            .getMarketplaceId(), catalogEntries.get(1).getMarketplace()
            .getMarketplaceId());

    serviceCalled = true;
    returnedMarketplaces = new ArrayList<VOMarketplace>();
    bean.getMarketplacesForSupplier();
    Assert.assertTrue(serviceCalled);
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:26,代码来源:MarketplaceBeanTest.java

示例14: createProjectClassLoader

import java.util.ArrayList; //导入依赖的package包/类
private static ClassLoader[] createProjectClassLoader(MavenProjectContext projectContext) {
    try {
        List<URL> compileJars = new ArrayList<>();

        for (String element : projectContext.getProject().getCompileClasspathElements()) {
            compileJars.add(new File(element).toURI().toURL());
        }
        return new ClassLoader[]{
            new URLClassLoader(compileJars.toArray(new URL[compileJars.size()]),
                               MavenEnricherManager.class.getClassLoader())
        };

    } catch (Exception e) {
        projectContext.getLogger().warn("Instructed to use project classpath, but cannot. Continuing build if we can: ", e);
        return new ClassLoader[0];
    }
}
 
开发者ID:fabric8io,项目名称:fabric8-build,代码行数:18,代码来源:MavenEnricherManager.java

示例15: createEvaluator

import java.util.ArrayList; //导入依赖的package包/类
private PropertyEvaluator createEvaluator() {
    PropertyProvider predefs = helper.getStockPropertyPreprovider();
    File dir = getProjectDirectoryFile();
    List<PropertyProvider> providers = new ArrayList<PropertyProvider>();
    providers.add(helper.getPropertyProvider("nbproject/private/platform-private.properties")); // NOI18N
    providers.add(helper.getPropertyProvider("nbproject/platform.properties")); // NOI18N
    PropertyEvaluator baseEval = PropertyUtils.sequentialPropertyEvaluator(predefs, providers.toArray(new PropertyProvider[providers.size()]));
    providers.add(new ApisupportAntUtils.UserPropertiesFileProvider(baseEval, dir));
    baseEval = PropertyUtils.sequentialPropertyEvaluator(predefs, providers.toArray(new PropertyProvider[providers.size()]));
    providers.add(new DestDirProvider(baseEval));
    providers.add(helper.getPropertyProvider(AntProjectHelper.PRIVATE_PROPERTIES_PATH));
    providers.add(helper.getPropertyProvider(AntProjectHelper.PROJECT_PROPERTIES_PATH));
    Map<String,String> fixedProps = new HashMap<String,String>();
    // synchronize with suite.xml
    fixedProps.put(SuiteProperties.ENABLED_CLUSTERS_PROPERTY, "");
    fixedProps.put(SuiteProperties.DISABLED_CLUSTERS_PROPERTY, "");
    fixedProps.put(SuiteProperties.DISABLED_MODULES_PROPERTY, "");
    fixedProps.put(SuiteBrandingModel.BRANDING_DIR_PROPERTY, "branding"); // NOI18N
    fixedProps.put("suite.build.dir", "build"); // NOI18N
    fixedProps.put("cluster", "${suite.build.dir}/cluster"); // NOI18N
    fixedProps.put("dist.dir", "dist"); // NOI18N
    fixedProps.put("test.user.dir", "${suite.build.dir}/testuserdir"); // NOI18N
    providers.add(PropertyUtils.fixedPropertyProvider(fixedProps));
    return PropertyUtils.sequentialPropertyEvaluator(predefs, providers.toArray(new PropertyProvider[providers.size()]));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:SuiteProject.java


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