Tutorial by Examples: c

Suppose the following generic interface has been declared: public interface MyGenericInterface<T> { public void foo(T t); } Below are listed the possible ways to implement it. Non-generic class implementation with a specific type Choose a specific type to replace the formal type ...
This option enables the use of call profiling for code optimizations. Profiling records useful runtime statistics specific to the application and can—in many cases—increase performance because JVM can then act on those statistics. Note: This option is supported with the JRockit JVM R27.3.0 and la...
This option disables the garbage collector strategy changes. Compaction heuristics and nursery size heuristics are not affected by this option. By default, the garbage collection heuristics are enabled. Usage: -XXdisableFatSpin
We can use Channel to copy file content faster. To do so, we can use transferTo() method of FileChannel . import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.nio.channels.FileChannel; public class FileCopier { ...
Plain lists are useful for representing a sequence of elements, but sometimes it is more helpful to represent a kind of key to value mapping. Common Lisp provides several ways to do this, including genuine hash tables (see 18.1 Hash Table Concepts). There are two primary ways or representing key t...
The double tap, like a single tap, also uses the UITapGestureRecognizer. You simply set the numberOfTapsRequired to 2. Swift override func viewDidLoad() { super.viewDidLoad() // Double Tap let doubleTapGesture = UITapGestureRecognizer(target: self, action: #selector(handleDoubleTa...
The UILongPressGestureRecognizer lets you listen for a long press on a view. You can set the length of delay before the action method is called. Swift override func viewDidLoad() { super.viewDidLoad() // Long Press let longPressGesture = UILongPressGestureRecognizer(target: self, ...
Swipe gestures allow you to listen for the user moving their finger across the screen quickly in a certain direction. Swift override func viewDidLoad() { super.viewDidLoad() // Swipe (right and left) let swipeRightGesture = UISwipeGestureRecognizer(target: self, action: #selector(...
Pinches are a two fingered gesture where the fingers move closer or farther from each other. This gesture is generally used for resizing a view. Swift override func viewDidLoad() { super.viewDidLoad() // Pinch let pinchGesture = UIPinchGestureRecognizer(target: self, action: #sele...
Two fingers rotating around a center can be listened for with the UIRotationGestureRecognizer. This is generally used for rotating a view. Swift override func viewDidLoad() { super.viewDidLoad() // Rotate let rotateGesture = UIRotationGestureRecognizer(target: self, action: #selec...
Drag a gesture recognizer from the object library onto your view. Control drag from the gesture in the Document Outline to your View Controller code in order to make an Outlet and an Action. Notes This example comes from this fuller sample project demonstrating gesture recognizers.
//Creates a Random instance with a seed of 12345. Random random = new Random(12345L); //Gets a ThreadLocalRandom instance ThreadLocalRandom tlr = ThreadLocalRandom.current(); //Set the instance's seed. tlr.setSeed(12345L); Using the same seed to generate random numbers will return the sa...
Time series data can be stored as a ts object. ts objects contain information about seasonal frequency that is used by ARIMA functions. It also allows for calling of elements in the series by date using the window command. #Create a dummy dataset of 100 observations x <- rnorm(100) #Convert ...
The current release version of Jetty is 9.4. Support is still provided for Jetty 9.2 and 9.3, and maintenance releases are provided for Jetty 7 and Jetty 8 when needed. The most up-to-date distributions can be found on the Jetty Downloads page. It is worth noting that current releases of Jetty requ...
Add below entries in pom.xml. <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-web</artifactId> <version>3.1.0.RELEASE</version> </dependency> <dependency> <groupId>org.springfr...
Bytecode is the set of instructions used by the JVM. To illustrate this let's take this Hello World program. public static void main(String[] args){ System.out.println("Hello World"); } This is what it turns into when compiled into bytecode. public static main([Ljava/lang/String...
/** * Load a class by from a ClassNode * * @param cn * ClassNode to load * @return */ public static Class<?> load(ClassNode cn) { ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES); return new ClassDefiner(ClassLoader.getSystemClassLoader()).get(cn....
public static void main(String[] args) throws Exception { File jarFile = new File("Input.jar"); Map<String, ClassNode> nodes = JarUtils.loadClasses(jarFile); Map<String, byte[]> out = JarUtils.loadNonClassEntries(jarFile); Map<String, String> map...
Objects come in their own class, so a simple example would be a car (detailed explanations below): public class Car { //Variables describing the characteristics of an individual car, varies per object private int milesPerGallon; private String name; private String color; ...
Preconnect The preconnect relationship is similar to dns-prefetch in that it will resolve the DNS. However, it will also make the TCP handshake, and optional TLS negotiation. This is an experimental feature. <link rel="preconnect" href="URL"> DNS-Prefetch Informs bro...

Page 310 of 826