- 1
- 2
- 3
- 4
- 5
- 6
- 7
import java.util.Optional;
public class Fuck {
public static <T> Optional<T> of(T o) {
return Optional.of(o);
}
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
Всего: 11
−2
import java.util.Optional;
public class Fuck {
public static <T> Optional<T> of(T o) {
return Optional.of(o);
}
}
−15
Collection<String> items = cart.getItems();
Assert.assertEquals(items.size(), new Integer("7").intValue());
+83
private static boolean[][] set = {
{T, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, T, T, x, x, x, x, x, x, x, x, x, x, x, x, x, T, T, x, T, T, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x},
{x, T, T, T, T, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, T, x, x, G, T, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x},
{x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, T, x, x, x, x, T, x, x, x, x, x, x, x, T, T, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x},
{x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, T, x, x, x, x, x, x, x, x, x, x, x, x, T, x, x, T, T, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x},
{x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, T, x, x, x, x, T, x, T, x, x, x, x, x, T, T, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x},
{x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, T, T, T, T, T, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x},
{x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, T, T, T, T, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x},
{x, T, T, T, T, T, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, T, T, T, T, T, T, T, T, T, T, x, x, T, T, T, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x},
{x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, T, x, x, x, x, x, x, x, x, x, x, x, x, T, x, x, T, T, T, T, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x},
{x, T, T, T, T, T, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, T, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, T, T, T, T, T, T, T, T, T, T, x, x, T, T, T, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x},
{x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, T, x, T, T, T, T, T, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x},
{x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, T, T, T, T, T, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x},
{x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, T, T, T, T, T, T, T, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, T, x, x, x},
{T, x, x, x, x, x, T, T, T, T, T, x, T, x, T, T, x, T, T, T, T, x, x, T, T, T, T, T, T, T, T, x, x, x, T, T, x, T, T, T, x, x, x, x, x, x, x, x, x, x, x, x, T, x, T, T, T, T, T, x, x, x, T, T, T, T, T, x, x, T, T, x, x, x, x, x, x, x, x, x, x, T, x, x, x, T, x, x, x, x, x, x, x, T, x, x, T, x, T, x, x, T, T, x, x},
{x, x, x, x, x, x, x, x, x, x, x, x, x, x, T, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, T, T, T, T, T, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x},
{T, T, T, T, T, T, x, x, x, x, x, x, x, x, x, x, x, x, x, T, T, x, x, x, x, x, x, x, x, x, x, x, x, x, T, T, x, T, T, T, T, T, T, T, T, T, T, T, T, T, x, x, T, T, T, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, T, x, T, x, x, x, x, x, x, T, T, x, x, x, x, x, x, x, x, x, x, x, x},
{x, x, x, x, x, x, x, T, T, T, T, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x},
{x, x, x, x, x, x, x, x, x, x, x, x, T, x, x, T, x, x, T, x, T, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, T, T, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, T, x, x, T, x, T, x, x, x, x, x, x}
};
Источник: http://sourceforge.net/p/squirrel-sql/code/HEAD/tree/tags/squirrelsql-3.4.0/app/src/main/java/net/sourceforge/squirrel_sql/client/session/parser/kernel/Parser.javа
+84
private static final int INT_5 = 5;
private static final int INT_3 = 3;
private static final int INT_4 = 4;
private static final int INT_6 = 6;
private static final int INT_7 = 7;
private static final int INT_8 = 8;
+76
public enum Permission{
SUPERUSER,
MANAGER,
USER;
public static Permission value(String name) {
return mapsValues.get(name);
}
private final static Map<String, Permission> mapsValues;
static {
Map<String, Permission> map= new HashMap<String, Permission>();
Permission[] pp = values();
for (Permission p : pp)
map.put(p.name(), p);
mapsValues = Collections.unmodifiableMap(map);
}
}
+75
/**
* NOTE: This source is automatically generated please do not modify this file.
* Either subclass or remove the record in src/generated
*/
public int getSize()
{
return 4 + + 1 + 1 + 2 + 1 + 1 + 1 + 1 + 2 + 2 + 2 + 2 + 2 + 2 + 4 + 4 + 4 + 2 + 4 + 4 + 4 + 2 + 4 + 2 + 2 + 4 + 4 + 4 + 2 + 4 + 4 + 4 + 2 + 4 + 2 + 310 + 10 + 2 + 2 + 12 + 4 + 4 + 4 + 4 + 30 + 4 + 4 + 4 + 4 + 4 + 2 + 2 + 2 + 2;
}
+158
$mazovia[18];
$iso[18];
$mazovia[0] = chr(134);$iso[0]=chr(177); //a~
$mazovia[1] = chr(143);$iso[1]=chr(161); //A~
$mazovia[2] = chr(141);$iso[2]=chr(230); //c~
$mazovia[3] = chr(149);$iso[3]=chr(198); //C~
$mazovia[4] = chr(145);$iso[4]=chr(234); //e~
$mazovia[5] = chr(144);$iso[5]=chr(202); //E~
$mazovia[6] = chr(146);$iso[6]=chr(179); //l~
$mazovia[7] = chr(156);$iso[7]=chr(163); //L~
$mazovia[8] = chr(164);$iso[8]=chr(241); //n~
$mazovia[9] = chr(165);$iso[9]=chr(209); //N~
$mazovia[10] = chr(162);$iso[10]=chr(243); //o~
$mazovia[11] = chr(163);$iso[11]=chr(211); //O~
$mazovia[12] = chr(158);$iso[12]=chr(182); //s~
$mazovia[13] = chr(152);$iso[13]=chr(166); //S~
$mazovia[14] = chr(166);$iso[14]=chr(188); //z~
$mazovia[15] = chr(160);$iso[15]=chr(172); //Z~
$mazovia[16] = chr(167);$iso[16]=chr(191); //z|
$mazovia[17] = chr(161);$iso[17]=chr(175); //Z|
$strmazovia="";
$strIso="";
for ($i=0;$i<=17;$i++){
$strmazovia=$strmazovia."\\".$mazovia[$i];
$strIso= $strIso."\\".$iso[$i];
}
function convert($str){
global $strmazovia;
global $strIso;
return StrTr($str,$strmazovia,$strIso);
}
−190
Запрос для базы даных MySQL :
$SQL=SELECT REPLACE( params,\
SUBSTRING(params,\
POSITION('thrift_port=' IN params),\
LENGTH('thrift_port=')+ LENGTH('11111') ),\
'thrift_port="${THRIFT_PORT}"')\
FROM jos_plugins WHERE element='thrift'
+77
public void actionPerformed(ActionEvent e) {
System.out.println("Przed utworzeniem resultseta");
Statement stm=null;
try{stm = Aplikacja.dajPolaczenieDB().createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);}
catch (SQLException ex){System.out.println("Wystąpił błąd przy próbie utworzemia Statement: "+ex.getLocalizedMessage());}
String z_sql = "SELECT id,imie FROM crm_sl_imion";
ResultSet rs=null;
try{rs = stm.executeQuery(z_sql);}
catch(SQLException e1){System.out.println("Wystąpił błąd przy próbie utworzeniu ResultSet'a: "+e1.getLocalizedMessage());}
try{
System.out.println("Rozpoczynam transakcje");
Aplikacja.dajPolaczenieDB().setAutoCommit(false);
}catch(SQLException e1){
System.out.println("Wystąpił błąd przy probie rozpoczęcia transkacji");
}
String z_insert="insert into crm_sl_imion(imie) values('Zdzisek')";
Statement stm2=null;
try{
stm2 = Aplikacja.dajPolaczenieDB().createStatement();
}catch(SQLException e1){
System.out.println("Wystąpił błąd przy próbie utowrzenia drugiego Stadementa: "+e1.getLocalizedMessage());
}
try{
stm2.execute(z_insert);
}catch(SQLException e1){
System.out.println("Wystąpił błąd przy próbie wykonywania sql'a: "+z_insert+", błąd: "+e1.getLocalizedMessage());
}
try{
System.out.println("Odwijam transakcje");
Aplikacja.dajPolaczenieDB().commit();
Aplikacja.dajPolaczenieDB().setAutoCommit(true);
}catch(SQLException e1){
System.out.println("Wystąpił błąd przy odwijaniu transakcji");
}
try{
while(rs.next()){
System.out.println("id: "+rs.getString("id")+" imie: "+rs.getString("imie"));
}
}catch(SQLException e2){
System.out.println("Wystąpił błąd przy próbie odczytania danych: "+e2.getLocalizedMessage());
}
try{
stm.close();
System.out.println("Po zamknięciu Statement'a");
}catch(SQLException e1){
System.out.println("Wystąpił błąd przy próbie zamknięcia Statement'a");
}
}
+75
float lan = getLan();
float lon = getLan();
if(lan == lan || lon == lon)
{
throw new RuntimeException("Bad value");
}
Из моего реалного проекта. Этот код реально делает полезную вещь