Mistři v programování na #hovnokod

O co slo ? Ziskame unikatni ID z databazove sequence. Ale pouzijeme jej pouze v urcitem pripade....

// uniqueId ziskavame pres databazovou sequenci
 String uniqueId = uniqueIdGeneratorService.getUniqueId();

 if (yyy instanceof XXX) {
            ((XXX) yyy).setUniqueId(uniqueId);
 }

Anonymous,

Kdyz uziti metody Map.values() nestaci.....

 for (String key : keyPairColl.keySet()) {
                  Object value = keyPairColl.get(key);
                  if (value.functionXXXX()) {
                         resultColl.add(YYY);
                   }
     }

Anonymous,

K navrácení boolean hodnoty je nezbytně nutné založit další pole...

public boolean existsUserPrivilegia(....)   {
......

 List<X> coll2 = new ArrayList<>(coll1.size());
        for(X item : coll1) {
            if(function(item)) {
                coll2.add(rule);
            }
        }
        return !coll2.isEmpty();
    }

Anonymous,

Divna konstrukce a jeste rozkopirovana po 4 tridach. Mas moc dobrou naladu ? Pust si SonarLint na vlastnim projektu....

Matcher m = p.matcher(input);
boolean match = (m.matches());
		if (!match) {
			return (false);
		}

		if (match) {
         ........................
                 }

Anonymous,

Dělá to to samé, ale je toho 2x více...

	switch (currDirection) {
		case LEFT: {
			notifyDirection(Direction.TOP);
			notifyDirection(Direction.BOTTOM);
			break;
		}
		case TOP: {
			notifyDirection(Direction.LEFT);
			notifyDirection(Direction.RIGHT);
			break;
		}
		case RIGHT: {
			notifyDirection(Direction.TOP);
			notifyDirection(Direction.BOTTOM);
			break;
		}
		case BOTTOM: {
			notifyDirection(Direction.LEFT);
			notifyDirection(Direction.RIGHT);
			break;
		}
		default:
			break;
		}

Anonymous,