This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
find . -iname "*.java" -exec sed s/\;$// {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Promises { | |
private static class PageMetrics { | |
Integer visits; | |
Long avgMsOnPage; | |
@Override | |
public String toString() { | |
return String.format("{ avgMsOnPage=%d, visits=%d }", avgMsOnPage, visits); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MemoizedLambdaFib { | |
interface MemoizedFunction<T, R> { | |
enum Cache { | |
_; | |
Map<Object, Object> vals = new HashMap<>(); | |
} | |
R calc(T t); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TrampolineLambda { | |
interface TrampolineFunction<T, R> { | |
R apply(T...obj); | |
public default Object trampoline(T...objs) { | |
Object result = apply(objs); | |
if (!(result instanceof TrampolineFunction)) { | |
return result; | |
} else { | |
return this; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ImprovedNamingDescriptorCustomizer implements DescriptorCustomizer { | |
@Override | |
public void customize(ClassDescriptor classDescriptor) throws Exception { | |
String className = classDescriptor.getJavaClassName(); | |
String shortName = Helper.getShortClassName(className); | |
String improvedName = toImprovedName(shortName); | |
classDescriptor.setTableName(improvedName); | |
updateMappings(classDescriptor, improvedName); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.danveloper.reactor.config | |
reactor { | |
social { | |
twitter { | |
consumerKey = "ABCD" | |
consumerSecret = "EFGH" | |
accessToken = "IJKL" | |
accessTokenSecret = "MNOP" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.objectpartners.application.config | |
config { | |
social { | |
twitter { | |
consumerKey = "ABCD" | |
consumerSecret = "EFGH" | |
accessToken = "IJKL" | |
accessTokenSecret = "MNOP" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Payee { | |
String name | |
String phoneNumber | |
Address billingAddress | |
} | |
public interface PaymentType { | |
Payee getPayee(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LocalPaymentService implements PaymentService { | |
// Dependency injected from container | |
CreditCardPaymentGateway creditCardPaymentGateway | |
GiftCardPaymentGateway giftCardPaymentGateway | |
CheckPaymentGateway checkPaymentGateway | |
EmployeePaymentGateway employeePaymentGateway | |
public String process(PaymentType paymentType) throws IllegalArgumentException { | |
if (paymentType instanceof CreditCardPaymentType) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LocalPaymentService implements PaymentService { | |
// Dependency injected from container | |
CreditCardPaymentGateway creditCardPaymentGateway | |
GiftCardPaymentGateway giftCardPaymentGateway | |
CheckPaymentGateway checkPaymentGateway | |
EmployeePaymentGateway employeePaymentGateway | |
public String process(PaymentType paymentType) throws IllegalArgumentException { | |
if (paymentType instanceof CreditCardPaymentType) { |