Replaced Collection.size() > 0 through !Collection.isEmpty()
This commit is contained in:
parent
9bf5a75e2c
commit
5926dd2bd2
10 changed files with 19 additions and 19 deletions
|
@ -208,7 +208,7 @@ public class ClientCollection extends Collection {
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<Element> acceptElems = element.getChildren("accept", AtomService.ATOM_PROTOCOL);
|
final List<Element> acceptElems = element.getChildren("accept", AtomService.ATOM_PROTOCOL);
|
||||||
if (acceptElems != null && acceptElems.size() > 0) {
|
if (acceptElems != null && !acceptElems.isEmpty()) {
|
||||||
for (final Element acceptElem : acceptElems) {
|
for (final Element acceptElem : acceptElems) {
|
||||||
addAccept(acceptElem.getTextTrim());
|
addAccept(acceptElem.getTextTrim());
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ public class ClientEntry extends Entry {
|
||||||
* one content element per entry.
|
* one content element per entry.
|
||||||
*/
|
*/
|
||||||
public Content getContent() {
|
public Content getContent() {
|
||||||
if (getContents() != null && getContents().size() > 0) {
|
if (getContents() != null && !getContents().isEmpty()) {
|
||||||
final Content c = getContents().get(0);
|
final Content c = getContents().get(0);
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,7 +156,7 @@ public class ClientMediaEntry extends ClientEntry {
|
||||||
* resource data as an InputStream or as a byte array.
|
* resource data as an InputStream or as a byte array.
|
||||||
*/
|
*/
|
||||||
public InputStream getAsStream() throws ProponoException {
|
public InputStream getAsStream() throws ProponoException {
|
||||||
if (getContents() != null && getContents().size() > 0) {
|
if (getContents() != null && !getContents().isEmpty()) {
|
||||||
final Content c = getContents().get(0);
|
final Content c = getContents().get(0);
|
||||||
if (c.getSrc() != null) {
|
if (c.getSrc() != null) {
|
||||||
return getResourceAsStream();
|
return getResourceAsStream();
|
||||||
|
|
|
@ -241,7 +241,7 @@ public class Collection {
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<Element> acceptElems = element.getChildren("accept", AtomService.ATOM_PROTOCOL);
|
final List<Element> acceptElems = element.getChildren("accept", AtomService.ATOM_PROTOCOL);
|
||||||
if (acceptElems != null && acceptElems.size() > 0) {
|
if (acceptElems != null && !acceptElems.isEmpty()) {
|
||||||
for (final Element acceptElem : acceptElems) {
|
for (final Element acceptElem : acceptElems) {
|
||||||
addAccept(acceptElem.getTextTrim());
|
addAccept(acceptElem.getTextTrim());
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,7 @@ public class AtomEntry extends BaseBlogEntry implements BlogEntry {
|
||||||
}
|
}
|
||||||
final List<com.sun.syndication.feed.atom.Content> contents = entry.getContents();
|
final List<com.sun.syndication.feed.atom.Content> contents = entry.getContents();
|
||||||
com.sun.syndication.feed.atom.Content romeContent = null;
|
com.sun.syndication.feed.atom.Content romeContent = null;
|
||||||
if (contents != null && contents.size() > 0) {
|
if (contents != null && !contents.isEmpty()) {
|
||||||
romeContent = contents.get(0);
|
romeContent = contents.get(0);
|
||||||
}
|
}
|
||||||
if (romeContent != null) {
|
if (romeContent != null) {
|
||||||
|
@ -172,7 +172,7 @@ public class AtomEntry extends BaseBlogEntry implements BlogEntry {
|
||||||
categories = cats;
|
categories = cats;
|
||||||
}
|
}
|
||||||
final List<SyndPerson> authors = entry.getAuthors();
|
final List<SyndPerson> authors = entry.getAuthors();
|
||||||
if (authors != null && authors.size() > 0) {
|
if (authors != null && !authors.isEmpty()) {
|
||||||
final com.sun.syndication.feed.atom.Person romeAuthor = (com.sun.syndication.feed.atom.Person) authors.get(0);
|
final com.sun.syndication.feed.atom.Person romeAuthor = (com.sun.syndication.feed.atom.Person) authors.get(0);
|
||||||
if (romeAuthor != null) {
|
if (romeAuthor != null) {
|
||||||
author = new Person();
|
author = new Person();
|
||||||
|
|
|
@ -106,7 +106,7 @@ public class MetaWeblogEntry extends BaseBlogEntry {
|
||||||
if (getContent() != null && getContent().getValue() != null) {
|
if (getContent() != null && getContent().getValue() != null) {
|
||||||
struct.put("description", getContent().getValue());
|
struct.put("description", getContent().getValue());
|
||||||
}
|
}
|
||||||
if (getCategories() != null && getCategories().size() > 0) {
|
if (getCategories() != null && !getCategories().isEmpty()) {
|
||||||
final List<String> catArray = new ArrayList<String>();
|
final List<String> catArray = new ArrayList<String>();
|
||||||
final List<Category> cats = getCategories();
|
final List<Category> cats = getCategories();
|
||||||
for (int i = 0; i < cats.size(); i++) {
|
for (int i = 0; i < cats.size(); i++) {
|
||||||
|
|
|
@ -115,7 +115,7 @@ public class AtomClientTest extends TestCase {
|
||||||
*/
|
*/
|
||||||
public void testGetAtomService() throws Exception {
|
public void testGetAtomService() throws Exception {
|
||||||
assertNotNull(service);
|
assertNotNull(service);
|
||||||
assertTrue(service.getWorkspaces().size() > 0);
|
assertTrue(!service.getWorkspaces().isEmpty());
|
||||||
for (final Object element : service.getWorkspaces()) {
|
for (final Object element : service.getWorkspaces()) {
|
||||||
final ClientWorkspace space = (ClientWorkspace) element;
|
final ClientWorkspace space = (ClientWorkspace) element;
|
||||||
assertNotNull(space.getTitle());
|
assertNotNull(space.getTitle());
|
||||||
|
@ -135,7 +135,7 @@ public class AtomClientTest extends TestCase {
|
||||||
*/
|
*/
|
||||||
public void testSimpleEntryPostAndRemove() throws Exception {
|
public void testSimpleEntryPostAndRemove() throws Exception {
|
||||||
assertNotNull(service);
|
assertNotNull(service);
|
||||||
assertTrue(service.getWorkspaces().size() > 0);
|
assertTrue(!service.getWorkspaces().isEmpty());
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (final Object element : service.getWorkspaces()) {
|
for (final Object element : service.getWorkspaces()) {
|
||||||
final ClientWorkspace space = (ClientWorkspace) element;
|
final ClientWorkspace space = (ClientWorkspace) element;
|
||||||
|
@ -183,7 +183,7 @@ public class AtomClientTest extends TestCase {
|
||||||
*/
|
*/
|
||||||
public void testSimpleEntryPostUpdateAndRemove() throws Exception {
|
public void testSimpleEntryPostUpdateAndRemove() throws Exception {
|
||||||
assertNotNull(service);
|
assertNotNull(service);
|
||||||
assertTrue(service.getWorkspaces().size() > 0);
|
assertTrue(!service.getWorkspaces().isEmpty());
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (final Object element : service.getWorkspaces()) {
|
for (final Object element : service.getWorkspaces()) {
|
||||||
final ClientWorkspace space = (ClientWorkspace) element;
|
final ClientWorkspace space = (ClientWorkspace) element;
|
||||||
|
@ -266,7 +266,7 @@ public class AtomClientTest extends TestCase {
|
||||||
*/
|
*/
|
||||||
public void testEntryPostWithCategories() throws Exception {
|
public void testEntryPostWithCategories() throws Exception {
|
||||||
assertNotNull(service);
|
assertNotNull(service);
|
||||||
assertTrue(service.getWorkspaces().size() > 0);
|
assertTrue(!service.getWorkspaces().isEmpty());
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (final Object element2 : service.getWorkspaces()) {
|
for (final Object element2 : service.getWorkspaces()) {
|
||||||
final ClientWorkspace space = (ClientWorkspace) element2;
|
final ClientWorkspace space = (ClientWorkspace) element2;
|
||||||
|
@ -359,7 +359,7 @@ public class AtomClientTest extends TestCase {
|
||||||
*/
|
*/
|
||||||
public void testMediaPost() throws Exception {
|
public void testMediaPost() throws Exception {
|
||||||
assertNotNull(service);
|
assertNotNull(service);
|
||||||
assertTrue(service.getWorkspaces().size() > 0);
|
assertTrue(!service.getWorkspaces().isEmpty());
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (final Object element : service.getWorkspaces()) {
|
for (final Object element : service.getWorkspaces()) {
|
||||||
final ClientWorkspace space = (ClientWorkspace) element;
|
final ClientWorkspace space = (ClientWorkspace) element;
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class AtomServiceTest extends TestCase {
|
||||||
assertNotNull(col.getTitle());
|
assertNotNull(col.getTitle());
|
||||||
assertNotNull(col.getHrefResolved());
|
assertNotNull(col.getHrefResolved());
|
||||||
int catCount = 0;
|
int catCount = 0;
|
||||||
if (col.getCategories().size() > 0) {
|
if (!col.getCategories().isEmpty()) {
|
||||||
for (final Object element3 : col.getCategories()) {
|
for (final Object element3 : col.getCategories()) {
|
||||||
final Categories cats = (Categories) element3;
|
final Categories cats = (Categories) element3;
|
||||||
catCount += cats.getCategories().size();
|
catCount += cats.getCategories().size();
|
||||||
|
|
|
@ -147,7 +147,7 @@ public class AtomClientServerTest {
|
||||||
@Test
|
@Test
|
||||||
public void testGetAtomService() throws Exception {
|
public void testGetAtomService() throws Exception {
|
||||||
assertNotNull(service);
|
assertNotNull(service);
|
||||||
assertTrue(service.getWorkspaces().size() > 0);
|
assertTrue(!service.getWorkspaces().isEmpty());
|
||||||
for (final Workspace workspace : service.getWorkspaces()) {
|
for (final Workspace workspace : service.getWorkspaces()) {
|
||||||
final ClientWorkspace space = (ClientWorkspace) workspace;
|
final ClientWorkspace space = (ClientWorkspace) workspace;
|
||||||
assertNotNull(space.getTitle());
|
assertNotNull(space.getTitle());
|
||||||
|
@ -168,7 +168,7 @@ public class AtomClientServerTest {
|
||||||
@Test
|
@Test
|
||||||
public void testSimpleEntryPostAndRemove() throws Exception {
|
public void testSimpleEntryPostAndRemove() throws Exception {
|
||||||
assertNotNull(service);
|
assertNotNull(service);
|
||||||
assertTrue(service.getWorkspaces().size() > 0);
|
assertTrue(!service.getWorkspaces().isEmpty());
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (final Object element : service.getWorkspaces()) {
|
for (final Object element : service.getWorkspaces()) {
|
||||||
final ClientWorkspace space = (ClientWorkspace) element;
|
final ClientWorkspace space = (ClientWorkspace) element;
|
||||||
|
@ -217,7 +217,7 @@ public class AtomClientServerTest {
|
||||||
@Test
|
@Test
|
||||||
public void testSimpleEntryPostUpdateAndRemove() throws Exception {
|
public void testSimpleEntryPostUpdateAndRemove() throws Exception {
|
||||||
assertNotNull(service);
|
assertNotNull(service);
|
||||||
assertTrue(service.getWorkspaces().size() > 0);
|
assertTrue(!service.getWorkspaces().isEmpty());
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (final Object element : service.getWorkspaces()) {
|
for (final Object element : service.getWorkspaces()) {
|
||||||
final ClientWorkspace space = (ClientWorkspace) element;
|
final ClientWorkspace space = (ClientWorkspace) element;
|
||||||
|
@ -302,7 +302,7 @@ public class AtomClientServerTest {
|
||||||
@Test
|
@Test
|
||||||
public void testEntryPostWithCategories() throws Exception {
|
public void testEntryPostWithCategories() throws Exception {
|
||||||
assertNotNull(service);
|
assertNotNull(service);
|
||||||
assertTrue(service.getWorkspaces().size() > 0);
|
assertTrue(!service.getWorkspaces().isEmpty());
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (final Object element2 : service.getWorkspaces()) {
|
for (final Object element2 : service.getWorkspaces()) {
|
||||||
final ClientWorkspace space = (ClientWorkspace) element2;
|
final ClientWorkspace space = (ClientWorkspace) element2;
|
||||||
|
@ -395,7 +395,7 @@ public class AtomClientServerTest {
|
||||||
*/
|
*/
|
||||||
public void testMediaPost() throws Exception {
|
public void testMediaPost() throws Exception {
|
||||||
assertNotNull(service);
|
assertNotNull(service);
|
||||||
assertTrue(service.getWorkspaces().size() > 0);
|
assertTrue(!service.getWorkspaces().isEmpty());
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (final Object element : service.getWorkspaces()) {
|
for (final Object element : service.getWorkspaces()) {
|
||||||
final ClientWorkspace space = (ClientWorkspace) element;
|
final ClientWorkspace space = (ClientWorkspace) element;
|
||||||
|
|
|
@ -130,7 +130,7 @@ public class SimpleBlogClientTest extends TestCase {
|
||||||
final BlogConnection conn = BlogConnectionFactory.getBlogConnection(type, endpoint, username, password);
|
final BlogConnection conn = BlogConnectionFactory.getBlogConnection(type, endpoint, username, password);
|
||||||
assertNotNull(conn);
|
assertNotNull(conn);
|
||||||
|
|
||||||
assertTrue(conn.getBlogs().size() > 0);
|
assertTrue(!conn.getBlogs().isEmpty());
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (final Blog blog2 : conn.getBlogs()) {
|
for (final Blog blog2 : conn.getBlogs()) {
|
||||||
final Blog blog = blog2;
|
final Blog blog = blog2;
|
||||||
|
|
Loading…
Reference in a new issue