public static String arrayToString(List list) {
if (list == null) {
throw new IllegalArgumentException("list is null");
}
return list.toString()
.replace("[", "") //remove the right bracket
.replace("]", "") //remove the left bracket
.trim();
}
int i = 0;
while (conn == null && i < 116) {
try {
Thread.sleep(i < 30 ? 2000 : (i < 40 ? 6000 : (i < 56 ? 30000 : 60000)));
} catch (Exception e) {
e.printStackTrace();
}
try {
conn = Server.getConnection();
} catch (Exception e) {
//e.printStackTrace();
}
i++;
if ((i < 41 && (i % 5) == 0)
|| (i > 40 && i < 45)
|| (i > 44 && i < 56 && (i % 2) == 0)
|| (i > 55 && ((i - 56) % 3) == 0))
System.out.print('.');
}
public abstract class AbstractInventoryProductFactoryManagerSingletonServiceManagerFactoryExceptionHandlerResourceHandlerDatabaseConnectionHandlerImpl {
private static AbstractInventoryProductFactoryManagerSingletonServiceManagerFactoryExceptionHandlerResourceHandlerDatabaseConnectionHandlerImpl theOneAndOnlyInstance;
private Connection theUnbreakableEverlastingDatabaseLifeline;
public static AbstractInventoryProductFactoryManagerSingletonServiceManagerFactoryExceptionHandlerResourceHandlerDatabaseConnectionHandlerImpl summonTheSingleton() {
if (theOneAndOnlyInstance == null) {
theOneAndOnlyInstance = new ConcreteImplementation();
}
return theOneAndOnlyInstance;
}
public abstract void initiateUnswervingDatabaseLinkWithCompulsiveRetriesAndUnyieldingTimeout();
public abstract InventoryProduct concoctAndJumpstartBrandNewInventoryProductPostRigorousValidation();
public abstract Service bootstrapAndEnrollNovelServicePostInfallibleAvailabilityCheck();
public abstract void seizeAndChronicleExceptionWithStackTrackAndSignalDeveloper(Exception e);
public abstract void manageAndFineTuneResourceConsumptionForPeakEfficiency(Resource resource);
public abstract void launchDatabaseTransactionWithOptimumIsolationLevel();
public abstract void ratifyDatabaseTransactionAndScourForPossibleConflicts();
public abstract void revokeDatabaseTransactionInEventOfUnforeseenErrors();
public abstract void safelySeverDatabaseConnectionAndLiberatePreciousResources();
}
public static Integer find(List<String> list, String name, int i) {
if(list.get(i).equals(name)) {
return i;
}
else return find(list, name, i+1)
}
public class Main {
public static void main(String[] args) {
try {
//code goes here
} catch (Exception e) {
System.exit(0);
}
}
}
String zeroPad(int number) {
return number < 10 ? "0" + number : String.valueOf(number);
}
You could just have done String.format("%02d", number);
public static <A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P> String get(A h, B u, C e, F l, G o, D v, E p, H a, I b, L c, K d, N f, J g, P i, M j, N m) {
StringBuilder yes = new StringBuilder();
yes.append((String) String.valueOf(h.toString()));
yes.append((String) String.valueOf(u.toString()));
yes.append((String) String.valueOf(e.toString()));
yes.append((String) String.valueOf(l.toString()));
yes.append((String) String.valueOf(o.toString()));
yes.append((String) String.valueOf(v.toString()));
yes.append((String) String.valueOf(p.toString()));
yes.append((String) String.valueOf(a.toString()));
yes.append((String) String.valueOf(b.toString()));
yes.append((String) String.valueOf(c.toString()));
yes.append((String) String.valueOf(d.toString()));
yes.append((String) String.valueOf(f.toString()));
yes.append((String) String.valueOf(h.toString()));
yes.append((String) String.valueOf(g.toString()));
yes.append((String) String.valueOf(i.toString()));
yes.append((String) String.valueOf(j.toString()));
return (String) String.valueOf(yes.toString());
}
why
public class CustomBoolean {
private Container<java.lang.Boolean> booleanContainer;
public CustomBoolean(Container<Boolean> booleanContainer) {
CustomBoolean custom_boolean = getThis();
custom_boolean.booleanContainer = booleanContainer;
}
private <T extends Object> T getThis() {
return (T) (Object) (T) this;
}
public Container<Boolean> getBooleanContainer() {
return booleanContainer;
}
public static CustomBoolean create(Boolean value) {
return new CustomBoolean(Container.builder().setValue(true).build());
}
public static void main(String[] args) {
System.out.println(CustomBoolean.create(Boolean.TRUE).getBooleanContainer().getObject());
}
public static class Container<T extends Object> {
private T object = null;
private Container(T object) {
Container<T> _this = getThis();
_this.object = (T) (Object) object;
}
private <T extends Object> T getThis() {
return (T) (Object) (T) this;
}
public static Builder builder() {
return new Builder();
}
public T getObject() {
return object;
}
public static class Builder<T extends Object> {
private T value;
public Builder<T> setValue(T value) {
Container<T> _this = getThis();
_this.object = (T) (Object) value;
return this;
}
private <T extends Object> T getThis() {
return (T) (Object) (T) this;
}
public Container build() {
return new Container(value);
}
}
}
} // Dort#0001
trolled
if (!recruiters
.stream().map(UserData::getUserName).collect(Collectors.toList())
.contains(recruiter.getUserData().getUserName())) {
}
spring.datasource.password=#{@secretsManager.getJsonField('${DSP_DB_SECRET:}', 'password', @secretsManager.getString('${DSP_DB_PASSWORD_SECRET:}', '${DSP_DB_PASSWORD:}'))}
String boot, 3 env variables written as string containing code executable code which cannot be verified by compiler. Welcome to Java
Path path = FileSystems.getDefault().getPath("../../../../../../../../../../EmailResults.csv");
Files.deleteIfExists(path);
@EventHandler
public void onCpUse(PlayerMoveEvent e) {
Player player = e.getPlayer();
if(Main.main.state != Gamestate.JUMP) return;
if(!Main.main.alive.contains(player)) return;
Location loc = e.getPlayer().getLocation();
loc.setY(loc.getY() -1);
Block standingOnBlock = loc.getBlock();
int currentCP = Main.main.checkpointTracker.get(player);
int nextCP = currentCP+1;
if(standingOnBlock.getType() == Material.EMERALD_BLOCK) {
Main.main.lm.setLocation(Main.main.map + "x" + nextCP + "x" + player.getName(), player.getLocation());
standingOnBlock.setType(Material.BEDROCK);
giveCPEquip(player, nextCP);
Main.main.checkpointTracker.put(player, nextCP);
Main.main.scoreboard.setIngameScoreboard(player);
player.sendMessage(Main.main.pr + "�aDu hast den " + nextCP + ". Checkpoint erreicht!");
if(Main.main.particleTracker.containsKey(player)) {
player.spawnParticle(Main.main.particleTracker.get(player), player.getLocation(), 10);
}
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 10, 1);
}
}
public void giveCPEquip(Player p, int cp) {
Inventory i = p.getInventory();
ItemStack cp1Helmet = Main.main.utils.create(Material.LEATHER_HELMET, 1);
ItemStack cp1Chest = Main.main.utils.create(Material.LEATHER_CHESTPLATE, 1);
ItemStack cp1Leggings = Main.main.utils.create(Material.LEATHER_LEGGINGS, 1);
ItemStack cp1Boots = Main.main.utils.create(Material.LEATHER_BOOTS, 1);
ItemStack cp2Sword = Main.main.utils.createSharp1Item(Material.STONE_SWORD, 1);
ItemStack cp3Apples = Main.main.utils.create(Material.GOLDEN_APPLE, 3);
ItemStack cp4Chest = Main.main.utils.create(Material.CHAINMAIL_CHESTPLATE, 1);
ItemStack cp4Leggings = Main.main.utils.create(Material.CHAINMAIL_LEGGINGS, 1);
ItemStack cp5Helmet = Main.main.utils.create(Material.IRON_HELMET, 1);
ItemStack cp5Boots = Main.main.utils.create(Material.IRON_BOOTS, 1);
//6 Add extra Herzen
ItemStack cp7Sword = Main.main.utils.create(Material.DIAMOND_SWORD, 1);
ItemStack cp8Sword = Main.main.utils.create(Material.SHIELD, 1);
ItemStack cp1Helmet1 = Main.main.utils.create(Material.DIAMOND_HELMET, 1);
ItemStack cp1Chest1 = Main.main.utils.create(Material.DIAMOND_CHESTPLATE, 1);
ItemStack cp1Leggings1 = Main.main.utils.create(Material.DIAMOND_LEGGINGS, 1);
ItemStack cp1Boots1 = Main.main.utils.create(Material.DIAMOND_BOOTS, 1);
ItemStack cp2Sword1 = Main.main.utils.createSharp1Item(Material.DIAMOND_SWORD, 1);
ItemStack cp3Apples1 = Main.main.utils.create(Material.SHIELD, 1);
ItemStack cp4Leggings1 = Main.main.utils.create(Material.NETHERITE_LEGGINGS, 1);
ItemStack cp5Helmet1 = Main.main.utils.create(Material.NETHERITE_HELMET, 1);
ItemStack cp5Boots1 = Main.main.utils.create(Material.NETHERITE_BOOTS, 1);
//6 Add extra Herzen
ItemStack cp7Sword1 = Main.main.utils.create(Material.NETHERITE_CHESTPLATE, 1);
ItemStack cp8Sword1 = Main.main.utils.createSharp1Item(Material.NETHERITE_SWORD, 1);
ItemStack cp1Helmet2 = Main.main.utils.create(Material.GOLDEN_HELMET, 1);
ItemStack cp1Chest2 = Main.main.utils.create(Material.GOLDEN_CHESTPLATE, 1);
ItemStack cp1Leggings2 = Main.main.utils.create(Material.GOLDEN_LEGGINGS, 1);
ItemStack cp1Boots2 = Main.main.utils.create(Material.GOLDEN_BOOTS, 1);
ItemStack cp2Sword2 = Main.main.utils.createSharp1Item(Material.STONE_SWORD, 1);
ItemStack cp3Apples2 = Main.main.utils.create(Material.GOLDEN_APPLE, 3);
ItemStack cp3Apple2 = Main.main.utils.create(Material.SHIELD, 1);
ItemStack cp4Leggings2 = Main.main.utils.create(Material.IRON_LEGGINGS, 1);
ItemStack cp5Helmet2 = Main.main.utils.create(Material.IRON_HELMET, 1);
ItemStack cp5Boots2 = Main.main.utils.create(Material.IRON_BOOTS, 1);
//6 Add extra Herzen
ItemStack cp7Sword2 = Main.main.utils.create(Material.IRON_CHESTPLATE, 1);
ItemStack cp8Sword2 = Main.main.utils.createSharp1Item(Material.IRON_SWORD, 1);
if(!Main.main.random) {
if(Main.main.rn ==0) {
if(cp == 1) {
i.addItem(cp1Helmet);
i.addItem(cp1Chest);
i.addItem(cp1Leggings);
i.addItem(cp1Boots);
}else if(cp == 2) {
i.addItem(cp2Sword);
}else if(cp == 3) {
i.addItem(cp3Apples);
}else if(cp == 4) {
i.addItem(cp4Chest);
i.addItem(cp4Leggings);
}else if(cp == 5) {
i.addItem(cp5Helmet);
i.addItem(cp5Boots);
}else if(cp == 6) {
p.setMaxHealth(24);
p.sendMessage(Main.main.pr + "�aDu hast zwei Extraherzen erhalten!");
}else if(cp == 7) {
i.addItem(cp7Sword);
}else if(cp == 8) {
i.addItem(cp8Sword);
if(Main.main.fallTracker.get(p) == 0) {
p.sendMessage(Main.main.pr + "Du hast das Ziel ohne JumpFail erreicht!");
p.getInventory().addItem(Main.main.utils.create(Material.DIAMOND_HELMET, 1));
}
Bukkit.broadcastMessage(Main.main.pr + "�5" + p.getName() + " �a hat das Ziel erreicht!");
Main.main.cd.cancelIngameTask();
Main.main.cd.startDeathmatchCD();
}
}else if(Main.main.rn == 1) {
if(cp == 1) {
i.addItem(cp1Helmet1);
i.addItem(cp1Chest1);
i.addItem(cp1Leggings1);
i.addItem(cp1Boots1);
}else if(cp == 2) {
i.addItem(cp2Sword1);
}else if(cp == 3) {
i.addItem(cp3Apples1);
}else if(cp == 4) {
i.addItem(cp4Leggings1);
}else if(cp == 5) {
i.addItem(cp5Helmet1);
i.addItem(cp5Boots1);
}else if(cp == 6) {
p.setMaxHealth(24);
p.sendMessage(Main.main.pr + "�aDu hast zwei Extraherzen erhalten!");
}else if(cp == 7) {
i.addItem(cp7Sword1);
}else if(cp == 8) {
i.addItem(cp8Sword1);
if(Main.main.fallTracker.get(p) == 0) {
p.sendMessage(Main.main.pr + "Du hast das Ziel ohne JumpFail erreicht!");
p.getInventory().addItem(Main.main.utils.create(Material.GOLDEN_APPLE, 10));
}
Bukkit.broadcastMessage(Main.main.pr + "�5" + p.getName() + " �a hat das Ziel erreicht!");
Main.main.cd.cancelIngameTask();
Main.main.cd.startDeathmatchCD();
}
}else if(Main.main.rn == 2) {
if(cp == 1) {
i.addItem(cp1Helmet2);
i.addItem(cp1Chest2);
i.addItem(cp1Leggings2);
i.addItem(cp1Boots2);
}else if(cp == 2) {
i.addItem(cp2Sword2);
}else if(cp == 3) {
i.addItem(cp3Apples2);
i.addItem(cp3Apple2);
}else if(cp == 4) {
i.addItem(cp4Leggings2);
}else if(cp == 5) {
i.addItem(cp5Helmet2);
i.addItem(cp5Boots2);
}else if(cp == 6) {
p.setMaxHealth(24);
p.sendMessage(Main.main.pr + "�aDu hast zwei Extraherzen erhalten!");
}else if(cp == 7) {
i.addItem(cp7Sword2);
}else if(cp == 8) {
i.addItem(cp8Sword2);
if(Main.main.fallTracker.get(p) == 0) {
p.sendMessage(Main.main.pr + "Du hast das Ziel ohne JumpFail erreicht!");
p.getInventory().addItem(Main.main.utils.create(Material.GOLDEN_APPLE, 10));
}
Bukkit.broadcastMessage(Main.main.pr + "�5" + p.getName() + " �a hat das Ziel erreicht!");
Main.main.cd.cancelIngameTask();
Main.main.cd.startDeathmatchCD();
}
}
}else {
Random random = new Random();
List<Material> materials = Arrays.asList(Material.values());
int size = materials.size()-1;
Material ran = materials.get(random.nextInt(size));
p.getInventory().addItem(new ItemStack(ran, 1));
if(cp == 8) {
if(Main.main.fallTracker.get(p) == 0) {
p.sendMessage(Main.main.pr + "Du hast das Ziel ohne JumpFail erreicht!");
p.getInventory().addItem(Main.main.utils.create(Material.DIAMOND_HELMET, 1));
}
Bukkit.broadcastMessage(Main.main.pr + "�5" + p.getName() + " �a hat das Ziel erreicht!");
Main.main.cd.cancelIngameTask();
Main.main.cd.startDeathmatchCD();
}
}
}
This beautiful code snippet was found in one of the repositories of people who sell their products on Fiverr. As you may have noticed only the functionally of code is beautiful but also the formatting style.
private boolean check_if_valid_login(Login login) {
boolean validLogin = false;
if (login.isValid(login)) {
validLogin = true;
}
if (!(login.isValid(login) == true)) {
validLogin = false;
}
return validLogin ? true : false;
}
class PythonClass {
protected boolean True = true;
protected boolean False = false;
protected Object None = null;
}
class MyClass extends PythonClass {
String do_something(Object foo) {
if (foo == False)
return "" ;
else if (foo == None)
return "!" ;
else if (foo == True)
return "Yay!" ;
}
}
Yikes
public enum DataSize {
BYTE,
DOUBLE_BYTE,
INT,
LONG;
public boolean isEqualTo(Object value) {
if(value instanceof Byte && this.equals(BYTE)) {
return true;
} else if ((value instanceof Character || value instanceof Short) && this.equals(DOUBLE_BYTE)) {
return true;
} else if ((value instanceof Integer) && this.equals(INT)) {
return true;
} else if ((value instanceof Long) && this.equals(LONG)) {
return true;
}
return false;
}
}