PhotoList<Photo> photosList = new PhotoList<>(); for (int i = 0; i < numPhotos; i++) { photosList.add( FlickrTestUtils.initializePhoto("title" + 1, "url" + i, "description" + i, MEDIA_TYPE));
/** * Parse a list of Photos from given Element. * * @param photosElement * @return PhotoList */ public static final PhotoList<Photo> createPhotoList(Element photosElement) { PhotoList<Photo> photos = new PhotoList<Photo>(); photos.setPage(photosElement.getAttribute("page")); photos.setPages(photosElement.getAttribute("pages")); photos.setPerPage(photosElement.getAttribute("perpage")); photos.setTotal(photosElement.getAttribute("total")); NodeList photoNodes = photosElement.getElementsByTagName("photo"); for (int i = 0; i < photoNodes.getLength(); i++) { Element photoElement = (Element) photoNodes.item(i); photos.add(PhotoUtils.createPhoto(photoElement)); } return photos; }
/** * Parse a list of Photos from given Element. * * @param photosElement * @return PhotoList */ public static final PhotoList<Photo> createPhotoList(Element photosElement) { PhotoList<Photo> photos = new PhotoList<Photo>(); photos.setPage(photosElement.getAttribute("page")); photos.setPages(photosElement.getAttribute("pages")); photos.setPerPage(photosElement.getAttribute("perpage")); photos.setTotal(photosElement.getAttribute("total")); NodeList photoNodes = photosElement.getElementsByTagName("photo"); for (int i = 0; i < photoNodes.getLength(); i++) { Element photoElement = (Element) photoNodes.item(i); photos.add(PhotoUtils.createPhoto(photoElement)); } return photos; }
/** * * @param response */ private PhotoList<Photo> parsePopularPhotos(Response response) { Element payload = response.getPayload(); PhotoList<Photo> photos = new PhotoList<Photo>(); NodeList photoElements = payload.getElementsByTagName("photo"); for (int i = 0; i < photoElements.getLength(); i++) { Element photoElement = (Element) photoElements.item(i); Photo photo = PhotoUtils.createPhoto(photoElement); Element statsElement = XMLUtilities.getChild(photoElement, "stats"); Stats stats = parseStats(statsElement); photo.setStats(stats); photos.add(photo); } return photos; }
/** * * @param response */ private PhotoList<Photo> parsePopularPhotos(Response response) { Element payload = response.getPayload(); PhotoList<Photo> photos = new PhotoList<Photo>(); NodeList photoElements = payload.getElementsByTagName("photo"); for (int i = 0; i < photoElements.getLength(); i++) { Element photoElement = (Element) photoElements.item(i); Photo photo = PhotoUtils.createPhoto(photoElement); Element statsElement = XMLUtilities.getChild(photoElement, "stats"); Stats stats = parseStats(statsElement); photo.setStats(stats); photos.add(photo); } return photos; }
for (int i = 0; i < photoNodes.getLength(); i++) { Element photoElement = (Element) photoNodes.item(i); photos.add(PhotoUtils.createPhoto(photoElement));
for (int i = 0; i < photoElements.getLength(); i++) { Element photoElement = (Element) photoElements.item(i); photos.add(PhotoUtils.createPhoto(photoElement));
for (int i = 0; i < photoElements.getLength(); i++) { Element photoElement = (Element) photoElements.item(i); photos.add(PhotoUtils.createPhoto(photoElement));
for (int i = 0; i < photoElements.getLength(); i++) { Element photoElement = (Element) photoElements.item(i); photos.add(PhotoUtils.createPhoto(photoElement));
Element photoElement = (Element) photoNodes.item(i); Photo photo = PhotoUtils.createPhoto(photoElement); photos.add(photo);
for (int i = 0; i < photoNodes.getLength(); i++) { Element photoElement = (Element) photoNodes.item(i); photos.add(PhotoUtils.createPhoto(photoElement));
for (int i = 0; i < photoNodes.getLength(); i++) { Element photoElement = (Element) photoNodes.item(i); photos.add(PhotoUtils.createPhoto(photoElement));
for (int i = 0; i < photoElements.getLength(); i++) { Element photoElement = (Element) photoElements.item(i); photos.add(PhotoUtils.createPhoto(photoElement));
for (int i = 0; i < photoNodes.getLength(); i++) { Element photoElement = (Element) photoNodes.item(i); photos.add(PhotoUtils.createPhoto(photoElement));
for (int i = 0; i < photoNodes.getLength(); i++) { Element photoElement = (Element) photoNodes.item(i); photos.add(PhotoUtils.createPhoto(photoElement));
for (int i = 0; i < photoNodes.getLength(); i++) { Element photoElement = (Element) photoNodes.item(i); photos.add(PhotoUtils.createPhoto(photoElement));
photo.setFriendFlag("1".equals(photoElement.getAttribute("isfriend"))); photo.setFamilyFlag("1".equals(photoElement.getAttribute("isfamily"))); photos.add(photo);
for (int i = 0; i < photoNodes.getLength(); i++) { Element photoElement = (Element) photoNodes.item(i); photos.add(PhotoUtils.createPhoto(photoElement));
for (int i = 0; i < photoNodes.getLength(); i++) { Element photoElement = (Element) photoNodes.item(i); photos.add(PhotoUtils.createPhoto(photoElement));
photo.setFriendFlag("1".equals(photoElement.getAttribute("isfriend"))); photo.setFamilyFlag("1".equals(photoElement.getAttribute("isfamily"))); photos.add(photo);