本文整理汇总了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()));
}
示例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());
}
示例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 "";
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
示例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);
}
}
示例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));
}
示例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();
}
示例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);
}
示例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);
}
示例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();
}