Mistři v programování na #hovnokod

Holy crap. Co takhle kolekce pouzit kdyz uz je pouzivas kamo?! Tohle je zahravani si s peklem...

		eb.setRecipients(StringUtils.join(recipients, "; "));
		eb.setRecipients2(StringUtils.join(recipients2, "; "));
		eb.setRecipients3(recipients3);
		eb.setSubject(subject);
		eb.setBody(body);
		eb.setType("Outage");
		eb.setSentBy(user.getUserName());
		eb.setSentDate(now);
		eb.setUpdatedBy(user.getUserName());
		eb.setUpdatedDate(now);

		emailsDao.save(eb);
		emailsCache.put(eb.getId(), eb);

		// send email(s)
		try {
			Email email = new Email(subject, body, "text/html");
			if (!recipients.isEmpty()) {
				for (String recipient : recipients) {
					email.addTo(recipient + "@ourdomain.com");
				}
			}
			if (!recipients2.isEmpty()) {
				for (String recipient : recipients2) {
					email.addTo(recipient + "@ourdomain.com");
				}
			}
			if (recipients3.length() != 0) {
				String[] recipients3AsArray = recipients3.split(";");
				for (String recipient : recipients3AsArray) {
					email.addTo(recipient.trim());
				}
			}
			email.send();
		}

Anonymous,

Bud alebo.

    enum Type {
        ITEM_IMAGE,
        ITEM_NO_IMAGE
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        if (viewType == Type.ITEM_IMAGE.ordinal() || viewType == Type.ITEM_NO_IMAGE.ordinal()) {
            return new ItemViewHolder();
        }
        return null;
    }

Anonymous,

Nazvoslovie: favs ~ favorites, songJson ~ songId, replace ~ removeIfExists, isAvailable ~ wasRemoved

private boolean addFavs(String songJson, boolean replace) {
Set<String> favs = getFavs();
boolean isAvailable = false;
if(!favs.contains(songJson)) {
    favs.add(songJson);
} else {
    if(replace) {
         favs.remove(songJson);
         isAvailable = true;
    }
}
// ...
}

Anonymous,


Anonymous,

Vyvinete, odladíte a otestujete novou vlastnost. Zaradujete se, že to je hotové a předtím než uděláte commit, tak se Vám povede místo do konsole napsat příkaz htop do vývojového prostředí a pak uděláte commit.

page.displayDialog(title,Type.INFO,
    new ConfirmPanel("resource.xxxxConfirmationDialoghtop"));

Anonymous,