Java - 打印ArrayList - 输出格式

时间:2015-11-05 23:53:16

标签: java for-loop arraylist

我无法正确打印出我的ArrayList。此时所有字符串在第一行重复,然后以下行重复第一行。

我想能够在每行打印字符串吗?任何帮助,将不胜感激。

代码

for(int i = 0; i < alreadyListed.size(); i++){
    System.out.println("Unique URLS - "+alreadyListed.toString());
}

}

输出

Unique URLS - [https://my.gov.au/LoginServices/main/login?execution=e1s1#leftcol, https://my.gov.au/LoginServices/main/login?execution=e1s1#footer-nav, https://my.gov.au/mygov/content/html/help.html, https://my.gov.au/mygov/content/html/about.html, https://my.gov.au/mygov/content/html/security.html, https://my.gov.au/mygov/content/html/privacy.html, https://my.gov.au/EnrolService/register.jsp?login=true&Return=/mygov, https://my.gov.au/CredentialManager/recoverUserId.jsp?Origin=&Return=/sps/auth&Login=true, https://my.gov.au/CredentialManager/resetPassword.jsp?Origin=&Return=/sps/auth&Login=true, https://my.gov.au/mygov/content/html/terms.html, https://my.gov.au/mygov/content/html/contact.html, https://my.gov.au/mygov/content/html/visit.html, https://my.gov.au/mygov/content/html/accessibility.html, https://my.gov.au/mygov/content/html/availability.html, https://my.gov.au/mygov/content/html/browsers.html]
Unique URLS - [https://my.gov.au/LoginServices/main/login?execution=e1s1#leftcol, https://my.gov.au/LoginServices/main/login?execution=e1s1#footer-nav, https://my.gov.au/mygov/content/html/help.html, https://my.gov.au/mygov/content/html/about.html, https://my.gov.au/mygov/content/html/security.html, https://my.gov.au/mygov/content/html/privacy.html, https://my.gov.au/EnrolService/register.jsp?login=true&Return=/mygov, https://my.gov.au/CredentialManager/recoverUserId.jsp?Origin=&Return=/sps/auth&Login=true, https://my.gov.au/CredentialManager/resetPassword.jsp?Origin=&Return=/sps/auth&Login=true, https://my.gov.au/mygov/content/html/terms.html, https://my.gov.au/mygov/content/html/contact.html, https://my.gov.au/mygov/content/html/visit.html, https://my.gov.au/mygov/content/html/accessibility.html, https://my.gov.au/mygov/content/html/availability.html, https://my.gov.au/mygov/content/html/browsers.html]
Unique URLS - [https://my.gov.au/LoginServices/main/login?execution=e1s1#leftcol, https://my.gov.au/LoginServices/main/login?execution=e1s1#footer-nav, https://my.gov.au/mygov/content/html/help.html, https://my.gov.au/mygov/content/html/about.html, https://my.gov.au/mygov/content/html/security.html, https://my.gov.au/mygov/content/html/privacy.html, https://my.gov.au/EnrolService/register.jsp?login=true&Return=/mygov, https://my.gov.au/CredentialManager/recoverUserId.jsp?Origin=&Return=/sps/auth&Login=true, https://my.gov.au/CredentialManager/resetPassword.jsp?Origin=&Return=/sps/auth&Login=true, https://my.gov.au/mygov/content/html/terms.html, https://my.gov.au/mygov/content/html/contact.html, https://my.gov.au/mygov/content/html/visit.html, https://my.gov.au/mygov/content/html/accessibility.html, https://my.gov.au/mygov/content/html/availability.html, https://my.gov.au/mygov/content/html/browsers.html]
Unique URLS - [https://my.gov.au/LoginServices/main/login?execution=e1s1#leftcol, https://my.gov.au/LoginServices/main/login?execution=e1s1#footer-nav, https://my.gov.au/mygov/content/html/help.html, https://my.gov.au/mygov/content/html/about.html, https://my.gov.au/mygov/content/html/security.html, https://my.gov.au/mygov/content/html/privacy.html, https://my.gov.au/EnrolService/register.jsp?login=true&Return=/mygov, https://my.gov.au/CredentialManager/recoverUserId.jsp?Origin=&Return=/sps/auth&Login=true, https://my.gov.au/CredentialManager/resetPassword.jsp?Origin=&Return=/sps/auth&Login=true, https://my.gov.au/mygov/content/html/terms.html, https://my.gov.au/mygov/content/html/contact.html, https://my.gov.au/mygov/content/html/visit.html, https://my.gov.au/mygov/content/html/accessibility.html, https://my.gov.au/mygov/content/html/availability.html, https://my.gov.au/mygov/content/html/browsers.html]
Unique URLS - [https://my.gov.au/LoginServices/main/login?execution=e1s1#leftcol, https://my.gov.au/LoginServices/main/login?execution=e1s1#footer-nav, https://my.gov.au/mygov/content/html/help.html, https://my.gov.au/mygov/content/html/about.html, https://my.gov.au/mygov/content/html/security.html, https://my.gov.au/mygov/content/html/privacy.html, https://my.gov.au/EnrolService/register.jsp?login=true&Return=/mygov, https://my.gov.au/CredentialManager/recoverUserId.jsp?Origin=&Return=/sps/auth&Login=true, https://my.gov.au/CredentialManager/resetPassword.jsp?Origin=&Return=/sps/auth&Login=true, https://my.gov.au/mygov/content/html/terms.html, https://my.gov.au/mygov/content/html/contact.html, https://my.gov.au/mygov/content/html/visit.html, https://my.gov.au/mygov/content/html/accessibility.html, https://my.gov.au/mygov/content/html/availability.html, https://my.gov.au/mygov/content/html/browsers.html]
Unique URLS - [https://my.gov.au/LoginServices/main/login?execution=e1s1#leftcol, https://my.gov.au/LoginServices/main/login?execution=e1s1#footer-nav, https://my.gov.au/mygov/content/html/help.html, https://my.gov.au/mygov/content/html/about.html, https://my.gov.au/mygov/content/html/security.html, https://my.gov.au/mygov/content/html/privacy.html, https://my.gov.au/EnrolService/register.jsp?login=true&Return=/mygov, https://my.gov.au/CredentialManager/recoverUserId.jsp?Origin=&Return=/sps/auth&Login=true, https://my.gov.au/CredentialManager/resetPassword.jsp?Origin=&Return=/sps/auth&Login=true, https://my.gov.au/mygov/content/html/terms.html, https://my.gov.au/mygov/content/html/contact.html, https://my.gov.au/mygov/content/html/visit.html, https://my.gov.au/mygov/content/html/accessibility.html, https://my.gov.au/mygov/content/html/availability.html, https://my.gov.au/mygov/content/html/browsers.html]
Unique URLS - [https://my.gov.au/LoginServices/main/login?execution=e1s1#leftcol, https://my.gov.au/LoginServices/main/login?execution=e1s1#footer-nav, https://my.gov.au/mygov/content/html/help.html, https://my.gov.au/mygov/content/html/about.html, https://my.gov.au/mygov/content/html/security.html, https://my.gov.au/mygov/content/html/privacy.html, https://my.gov.au/EnrolService/register.jsp?login=true&Return=/mygov, https://my.gov.au/CredentialManager/recoverUserId.jsp?Origin=&Return=/sps/auth&Login=true, https://my.gov.au/CredentialManager/resetPassword.jsp?Origin=&Return=/sps/auth&Login=true, https://my.gov.au/mygov/content/html/terms.html, https://my.gov.au/mygov/content/html/contact.html, https://my.gov.au/mygov/content/html/visit.html, https://my.gov.au/mygov/content/html/accessibility.html, https://my.gov.au/mygov/content/html/availability.html, https://my.gov.au/mygov/content/html/browsers.html]
Unique URLS - [https://my.gov.au/LoginServices/main/login?execution=e1s1#leftcol, https://my.gov.au/LoginServices/main/login?execution=e1s1#footer-nav, https://my.gov.au/mygov/content/html/help.html, https://my.gov.au/mygov/content/html/about.html, https://my.gov.au/mygov/content/html/security.html, https://my.gov.au/mygov/content/html/privacy.html, https://my.gov.au/EnrolService/register.jsp?login=true&Return=/mygov, https://my.gov.au/CredentialManager/recoverUserId.jsp?Origin=&Return=/sps/auth&Login=true, https://my.gov.au/CredentialManager/resetPassword.jsp?Origin=&Return=/sps/auth&Login=true, https://my.gov.au/mygov/content/html/terms.html, https://my.gov.au/mygov/content/html/contact.html, https://my.gov.au/mygov/content/html/visit.html, https://my.gov.au/mygov/content/html/accessibility.html, https://my.gov.au/mygov/content/html/availability.html, https://my.gov.au/mygov/content/html/browsers.html]
PASSED: main

0 个答案:

没有答案