當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。