- 1
 - 2
 - 3
 
/*
        todo it seems that code below will be right, when client will be changed
*/
                                    Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
Всего: 6
+82
/*
        todo it seems that code below will be right, when client will be changed
*/
                                    Вот такой емкий комментарий перед 200 закоментированными строками кода
+80
thread = new Thread() {
  @Override 
  public void run() {
    try {
      while( !dataProcessor.isFinished() ) {
        dataProcessor.execute();
        
        Thread.sleep( 60 * 1000L );
      }        
    } catch ( Throwable t ) {
      logger.fatal( "Fatal error in daemon thread", t );
    }
  }
};
thread.run();
                                    Вот такое оно параллельное выполнение. Задачка для догадливых.
+76
List<Record> getNewestRecords( int maxResults ) {
  List<TenantIssue> allRecords = recordsDao.getAllRecords();
  
  if ( allRecords.size() > maxResults ) {
    Collections.sort( allRecords, new Comparator() { 
      public int compare( Record r1, Record r2 ) {
        return (int) r1.getDate().getTime() - r2.getDate().getTime();
      } 
    } );
    Collections.reverse( allRecords );
    
    List<Record> newestRecords = new ArrayList<Record>();
    for ( int i = 0; i < maxResults; i++ ) {
      newestRecords.add( allRecords.get( i ) );
    }
  } else {
    return allRecords;
  }
  return allRecords;
}
                                    
+83
private double calculateValue( int number, int rate ) {
    return Math.pow( number, rate );
}
                                    
+86
new Date(System.currentTimeMillis());
                                    Просто и со вкусом
+77
@Entity
@Table(name = "datastore")
public final class Datastore
{
 @SequenceGenerator(name="SEQ_GEN", sequenceName="entity_id_seq", allocationSize = 1)
 @Id  
 @GeneratedValue(strategy=GenerationType.SEQUENCE, generator = "SEQ_GEN")
 private long entityid;
 public float  capacity;
 public String name;
 public float  usage;
 public short vendor;
 public short state;
 public short health;
 public short vmson;
 public short vmsother;    
 @Transient private String uuid;
 @Override public String toString() {
  return String.format("Datastore{entityid=%d, capacity=%f, health=%d, name='%s', state=%d, usage=%f, vendor=%d, vmson=%d, vmsother=%d}", 
   entityid,
   capacity,
   health,
   name,
   state,
   usage,
   vendor,
   vmson,
   vmsother);
 }
 public long getEntityid() {
  return entityid;
 }
 public void setEntityid(long entityid) {
  this.entityid = entityid;
 }
 public float getCapacity() {
  return capacity;
 }
 public void setCapacity(float capacity) {
  this.capacity = capacity;
 }
 public String getName() {
  return name;
 }
 public void setName(String name) {
  this.name = name;
 }
 public float getUsage() {
  return usage;
 }
 public void setUsage(float usage) {
  this.usage = usage;
 }
 public short getVendor() {
  return vendor;
 }
 public void setVendor(short vendor) {
  this.vendor = vendor;
 }
 public short getState() {
  return state;
 }
 public void setState(short state) {
  this.state = state;
 }
 public short getHealth() {
  return health;
 }
 public void setHealth(short health) {
  this.health = health;
 }
 public short getVmson() {
  return vmson;
 }
 public void setVmson(short vmson) {
  this.vmson = vmson;
 }
 public short getVmsoff() {
  return vmsother;
 }
 public void setVmsoff(short vmsoff) {
  this.vmsother = vmsoff;
 }
 
 @Transient public void   setUuid(String value) { this.uuid = value; }
}
                                    
            Вот так жесткие швейцарские кодеры объявляют persistent beans.
Самый отжиг это не pubilc fields дублированные с getters/setters, а setter помеченный @Transient