Skip to content

Instantly share code, notes, and snippets.

View aruld's full-sized avatar
🎯
Focusing

Arul Dhesiaseelan aruld

🎯
Focusing
View GitHub Profile
public interface Api {
// constant declarations
int CAFEBABE = 0xCAFEBABE;
// abstract methods
void foo(int data);
void bar(int data);
// default methods
@aruld
aruld / VisibilityTest.java
Created March 21, 2015 07:36
cannot reduce visibility of private methods
public class VisibilityTest {
interface I {
private void foo(int x) {}
private void bar(int x) {}
}
interface J extends I {
void foo(int x); // Valid: public abstract method with the same signature as a private method in super type is allowed.
default void bar(int x) {} // Valid: public default method with the same signature as a private method in super type is allowed.
}
@aruld
aruld / NameClashTest.java
Last active August 29, 2015 14:17
Name Clash
public class NameClashTest {
interface I {
void foo(int x);
private I foo() {
return null;
}
private void foo(int x) {} // Invalid: method foo(int) is already defined in interface NameClashTest.I
}
@Path("/sakila")
public class SakilaResource {
@Context
private SearchContext searchContext;
List<Actor> actors = new ArrayList<Actor>();
List<Film> films = new ArrayList<Film>();
List<Rental> rentals = new ArrayList<Rental>();
public class SakilaSearchTest {
static Server server;
@BeforeClass
public static void setUp() {
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setResourceClasses(SakilaResource.class);
sf.getInInterceptors().add(new LoggingInInterceptor());
sf.getOutInterceptors().add(new LoggingOutInterceptor());
package oscon.java.parallel;
import extra166y.Ops;
import extra166y.ParallelArray;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class GoingParallelInJava {
@aruld
aruld / SCPActionTest
Created August 12, 2011 05:18
SCPAction example
Factory factory = Factory.makeInstance();
EngineHelper helper = factory.makeEngineHelper();
FlowChart flowChart = helper.makeFlowChart("SCP Action Example");
SCPActionFactory scpActionFactory = (SCPActionFactory) flowChart.makeFactory("SCPActionFactory");
SCPAction downloadFile = scpActionFactory.makeSCPAction("SCP Download");
downloadFile.setHost("arul-ubuntu");
downloadFile.setUsername(System.getProperty("user.name"));
downloadFile.setDownload(true);
downloadFile.setRemotePath("Downloads/jdk-1_5_0_22-linux-i586.bin");
downloadFile.setLocalPath("/tmp/");
@aruld
aruld / defaults.dart
Created October 19, 2011 17:31
Dart optional defaults
main() {
test(var a, [b = 54]) {
print(b);
}
test(10);
}
@aruld
aruld / functiontest.dart
Created October 19, 2011 17:19
Dart Functions
class FunctionTest {
FunctionTest(this.myFunc);
Function myFunc;
num run(num n) {
return myFunc(n);
}
}
main() {
var square = (aNumber) => aNumber * aNumber;
var result = new FunctionTest(square).run(5);
@aruld
aruld / foobar.dart
Created October 19, 2011 18:26
My first Dart script
class foobar {
foo() {
return '00';
}
bar() {
return 7;
}
}
main() {