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


Java ArrayList.toString方法代码示例

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


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

示例1: testDrawNumbersCallRemovesOldNumbersAndDrawsNew

import java.util.ArrayList; //导入方法依赖的package包/类
@Test
public void testDrawNumbersCallRemovesOldNumbersAndDrawsNew() {
    LotteryNumbers lottoRivi;
    ArrayList<Integer> numerot;
    try {
        lottoRivi = new LotteryNumbers();
        numerot = lottoRivi.numbers();
    } catch (Throwable t) {
        fail("Something went wrong when creating a new LotteryNumbers object! More info: " + t);
        return;
    }
    String numerotString = numerot.toString();
    assertEquals("The size of number list should be seven!", 7, numerot.size());
    lottoRivi.drawNumbers();
    assertEquals("The size of number list should be seven after drawNumbers call!", 7, lottoRivi.numbers().size());
    assertFalse("New numbers should have been drawn with drawNumbers call! Numbers were " + numerotString,numerotString.equals(lottoRivi.numbers().toString()));
}
 
开发者ID:gengwg,项目名称:java_mooc_fi,代码行数:18,代码来源:LotteryNumbersTest.java

示例2: find

import java.util.ArrayList; //导入方法依赖的package包/类
/**
 * Smith-Waterman算法寻找两个字符串中匹配度最高的子串
 *
 * @param s1 第一个字符串
 * @param s2 第二个字符串
 * @return 匹配度最高的子串
 */
public static SeqResult find(String s1, String s2) {
	//initMatrix(s1.length(), s2.length());
	Info info = new Info();
	int i, j;
	info.H = new int[s1.length() + 1][s2.length() + 1];
	info.isEmpty = new int[s1.length() + 1][s2.length() + 1];
	for (i = 0; i <= s1.length(); i++)
		for (j = 0; j <= s2.length(); j++)
			info.isEmpty[i][j] = 1;
	calculateMatrix(info, s1, s2, s1.length(), s2.length());
	findMaxIndex(info, info.H.length, info.H[0].length);
	traceBack(info, s1, s2, info.maxIndexM, info.maxIndexN);
	ArrayList<Character> arr1 = new ArrayList<Character>();
	ArrayList<Character> arr2 = new ArrayList<Character>();
	while (!info.stk1.empty())
		arr1.add(info.stk1.pop());
	while (!info.stk2.empty())
		arr2.add(info.stk2.pop());
	return new SeqResult(arr1.toString(), arr2.toString());
}
 
开发者ID:SvenAugustus,项目名称:Divinity_Original_Sin_2_zhCN,代码行数:28,代码来源:SmithWaterman.java

示例3: fillResultString

import java.util.ArrayList; //导入方法依赖的package包/类
private String fillResultString()
{
    if (resultType == ResultType.NAN)
    {
        return TermParser.CONST_NAN;
    }

    if (resultType == ResultType.CONSTANT)
    {
        return constantResult.getResultDescription(getFormulaList().getDocumentSettings());
    }

    if (isArrayResult())
    {
        final ArrayList<ArrayList<String>> res = fillResultMatrixArray();
        if (res != null)
        {
            return res.toString();
        }
    }
    return "";
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:23,代码来源:FormulaResult.java

示例4: returnEntireCatalogue

import java.util.ArrayList; //导入方法依赖的package包/类
private String returnEntireCatalogue() {
  	ArrayList<String> items = Catalogue.returnAllItems();
  	String jsonResponse = null;
  	if(items.size() != 0)
	jsonResponse = Catalogue.baseString+",\"items\":"+items.toString()+"}";
else
	jsonResponse = Catalogue.baseString+"}";
  	return jsonResponse;
  }
 
开发者ID:dream-lab,项目名称:echo,代码行数:10,代码来源:Search.java

示例5: prefixSearch

import java.util.ArrayList; //导入方法依赖的package包/类
private String prefixSearch(String prefixhref) {
  	ArrayList<String> items = Catalogue.searchByHrefPrefix(prefixhref);
  	String jsonResponse = null;
  	if(items.size() != 0)
	jsonResponse = Catalogue.baseString+",\"items\":"+items.toString()+"}";
else
	jsonResponse = Catalogue.baseString+"}";
  	return jsonResponse;
  }
 
开发者ID:dream-lab,项目名称:echo,代码行数:10,代码来源:Search.java

示例6: testColoringProfiles

import java.util.ArrayList; //导入方法依赖的package包/类
public void testColoringProfiles() {
    Set<String> profiles = EditorSettings.getDefault().getFontColorProfiles();
    ArrayList<String> sortedProfiles = new ArrayList<String>(profiles);
    Collections.sort(sortedProfiles);
    String currentProfiles = sortedProfiles.toString();
    assertEquals("Wrong coloring profiles",
        "[CityLights, NetBeans]",
        currentProfiles);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:Pre90403Phase1CompatibilityTest.java

示例7: testMimeTypesWithColorings

import java.util.ArrayList; //导入方法依赖的package包/类
public void testMimeTypesWithColorings() {
    Set<String> mimeTypes = EditorSettings.getDefault().getMimeTypes();
    ArrayList<String> sortedMimeTypes = new ArrayList<String>(mimeTypes);
    Collections.sort(sortedMimeTypes);
    String currentMimeTypes = sortedMimeTypes.toString();
    assertEquals("Wrong coloring mime types",
        "[application/xml-dtd, text/css, text/html, text/plain, text/x-el, text/x-java, text/x-jsp, text/x-properties, text/x-sql, text/x-tag, text/xml]",
        currentMimeTypes);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:Pre90403Phase1CompatibilityTest.java

示例8: testKeybindingsProfiles

import java.util.ArrayList; //导入方法依赖的package包/类
public void testKeybindingsProfiles() {
    Set<String> profiles = EditorSettings.getDefault().getKeyMapProfiles();
    ArrayList<String> sortedProfiles = new ArrayList<String>(profiles);
    Collections.sort(sortedProfiles);
    String currentProfiles = sortedProfiles.toString();
    assertEquals("Wrong keybindings profiles",
        "[Eclipse, Emacs, NetBeans]",
        currentProfiles);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:Pre90403Phase1CompatibilityTest.java

示例9: getChooseIds

import java.util.ArrayList; //导入方法依赖的package包/类
public String getChooseIds() {
    ArrayList<String> ids = new ArrayList<>();
    for (ComMember info : mChoose) {
        ids.add(info.getId() + "");
    }
    return ids.toString();
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:8,代码来源:ChooseFriendsAdapter.java

示例10: test

import java.util.ArrayList; //导入方法依赖的package包/类
public void test(int len, ArrayList in) {
    String s = in.toString();
    try {
        assertEquals("Counting the number of items in list "+s+" went wrong!",
                     len,
                     (int) ReflectionUtils.invokeMethod(Integer.TYPE, m, null, in));
    } catch (Throwable t) {
        fail("Something went wrong when countItems was called to list "+s+". \nMore info: "+t);
    }
}
 
开发者ID:gengwg,项目名称:java_mooc_fi,代码行数:11,代码来源:NumberOfItemsTest.java

示例11: executeInternal

import java.util.ArrayList; //导入方法依赖的package包/类
@Override
public void executeInternal() throws Exception {
    IdentityService idSvc = getServiceInterface(IdentityService.class);

    VOUserDetails user = new VOUserDetails();
    user.setOrganizationId(getOrganizationId());
    user.setEMail(getEmail());
    user.setLocale(getLocale());
    ArrayList<UserRoleType> userRoleTypes = getUserRoleTypes();

    ArrayList<String> userKeys = new ArrayList<String>();
    int i = 0;
    while (i < number) {
        user.setFirstName(getRandomFirstName());
        user.setLastName(getRandomLastName());
        user.setUserId(getUniqueUserId());
        try {
            VOUserDetails u = idSvc.createUser(user, userRoleTypes,
                    getMarketplaceId());
            if (userKeys.size() < numUserKeysReturned) {
                userKeys.add(String.valueOf(u.getKey()));
            }
            i++;
        } catch (NonUniqueBusinessKeyException e) {
            // new try with another random user id
        }
    }
    String string = userKeys.toString();
    getProject().setProperty(userKeyProp,
            string.substring(1, string.length() - 1));
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:32,代码来源:UserRegisterMultipleTask.java

示例12: greeting

import java.util.ArrayList; //导入方法依赖的package包/类
@RequestMapping("/Test")
public String greeting(@AuthenticationPrincipal JwtUserDetails userDetails,
                       @RequestParam(value="name", required=false, defaultValue="World") String name) {

    ArrayList<String> scopes = userDetails.getJwt().getClaims().getClaim("scopes", ArrayList.class);

    return "Spring RS App invoked with valid JWT "+name+
            "<br>You authenticated to me as "+userDetails.getUsername()+
            " and have scopes of "+scopes.toString();
}
 
开发者ID:WASdev,项目名称:sample.microservices.security.jwt,代码行数:11,代码来源:GreetingController.java

示例13: handleLowMemoryException

import java.util.ArrayList; //导入方法依赖的package包/类
private void handleLowMemoryException(final GemFireException ge) {
  Set<DistributedMember> criticalMembers =
      ((LowMemoryException) ge.getRootCause()).getCriticalMembers();
  ArrayList<String> criticalMembersList = new ArrayList<>();
  criticalMembers.forEach(DM -> {
    criticalMembersList.add(DM.getName());
  });
  String errorMessage = "Members on Low Memory are " + criticalMembersList.toString();
  throw new MCacheLowMemoryException(errorMessage);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:11,代码来源:ProxyFTableRegion.java

示例14: format

import java.util.ArrayList; //导入方法依赖的package包/类
private static String format(String msg, Object... args) {
    if (args != null) {
        // expand Iterable parameters into a list representation
        for (int i = 0; i < args.length; i++) {
            if (args[i] instanceof Iterable<?>) {
                ArrayList<Object> list = new ArrayList<>();
                for (Object o : (Iterable<?>) args[i]) {
                    list.add(o);
                }
                args[i] = list.toString();
            }
        }
    }
    return String.format(Locale.ENGLISH, msg, args);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:GraalError.java

示例15: getGroupChatChunk

import java.util.ArrayList; //导入方法依赖的package包/类
public String getGroupChatChunk(int notebookId, int lastChat) {
    ArrayList<String> resultList = new ArrayList<String>();
    ArrayList<String> contents = getGroupChat(notebookId);
    int iterator;
    for(iterator = lastChat; (iterator > lastChat - 10) && (iterator >= 0); iterator--) {
        resultList.add(convertUtil.formMessage(contents.get(iterator)));
    }
    return resultList.toString();
}
 
开发者ID:qinjr,项目名称:TeamNote,代码行数:10,代码来源:CooperateServiceImpl.java


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