1 2 3 4 5 - - PowerPoint PPT Presentation

1
SMART_READER_LITE
LIVE PREVIEW

1 2 3 4 5 - - PowerPoint PPT Presentation

1 2 3 4 5 6 7 remove delete https://www.youtube.com/watch?v=SctS56YQ6fg 8 9


slide-1
SLIDE 1

1

slide-2
SLIDE 2

2

slide-3
SLIDE 3

3

slide-4
SLIDE 4

4

slide-5
SLIDE 5

5

slide-6
SLIDE 6

6

slide-7
SLIDE 7

7

slide-8
SLIDE 8

8

  • – remove

delete

  • https://www.youtube.com/watch?v=SctS56YQ6fg
slide-9
SLIDE 9

9

slide-10
SLIDE 10

10

Font, Set, PrivateKey, Lock, ThreadFactory, TimeUnit, Future<T> DynAnyFactoryOperations, _BindingIteratorImplBase, ENCODING_CDR_ENCAPS, OMGVMCID

https://assets.victorinox.com/mediahub/33790/640Wx560H/SAK_1_4713__S1.jpg

slide-11
SLIDE 11

11

public abstract class Calendar implements Serializable, Cloneable, Comparable<Calendar>

slide-12
SLIDE 12

12

Calendar rightNow = Calendar.getInstance();

etc., etc., etc., etc., etc., etc., etc., etc.

slide-13
SLIDE 13

13

Calendar

  • java.time
slide-14
SLIDE 14

14

– –

slide-15
SLIDE 15

15

– – arccos sin cos arcsin

slide-16
SLIDE 16

16

public class Vector { public int indexOf(Object elem, int index); public int lastIndexOf(Object elem, int index); ... }

index –

Vector –

slide-17
SLIDE 17

17

public interface List<T> { List<T> subList(int fromIndex, int toIndex); ... }

  • List
slide-18
SLIDE 18

18

import org.w3c.dom.*;

import java.io.*; import javax.xml.transform.*; import javax.xml.transform.dom.*; import javax.xml.transform.stream.*; // DOM code to write an XML document to a specified output stream. static final void writeDoc(Document doc, OutputStream out) throws IOException { try { Transformer t = TransformerFactory.newInstance().newTransformer(); t.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, doc.getDoctype().getSystemId()); t.transform(new DOMSource(doc), new StreamResult(out)); } catch(TransformerException e) { throw new AssertionError(e); // Can’t happen! } }

slide-19
SLIDE 19

19

slide-20
SLIDE 20

20

  • Complexity
slide-21
SLIDE 21

21

slide-22
SLIDE 22

22

– –

try

slide-23
SLIDE 23

23

slide-24
SLIDE 24

24

– –

slide-25
SLIDE 25

25

  • Component.getSize()

Dimension

  • Dimension
  • getSize

Dimension

slide-26
SLIDE 26

26

slide-27
SLIDE 27

27

slide-28
SLIDE 28

28

Date, Calendar, Thread.interrupt BigInteger, Pattern, Matcher

slide-29
SLIDE 29

29

slide-30
SLIDE 30

30

java.util.Properties java.util.Stack

  • Foo

Bar

slide-31
SLIDE 31

31

  • Foo

Bar

slide-32
SLIDE 32

32

  • AbstractSet AbstractMap
slide-33
SLIDE 33

33

slide-34
SLIDE 34

34

slide-35
SLIDE 35

35

// The WRONG way to require one or more arguments! static int min(int... args) { if (args.length == 0) throw new IllegalArgumentException("Need at least 1 arg"); int min = args[0]; for (int i = 1; i < args.length; i++) if (args[i] < min) min = args[i]; return min; }

slide-36
SLIDE 36

36

// The right way to require one or more arguments static int min(int firstArg, int... remainingArgs) { int min = firstArg; for (int arg : remainingArgs) if (arg < min) min = arg; return min; }

slide-37
SLIDE 37

37

slide-38
SLIDE 38

38

// A Properties instance maps strings to strings public class Properties extends Hashtable { public Object put(Object key, Object value); // Throws ClassCastException if this properties // contains any keys or values that are not strings public void save(OutputStream out, String comments); }

slide-39
SLIDE 39

39

  • null

package java.awt.image; public interface BufferedImageOp { // Returns the rendering hints for this operation, // or null if no hints have been set. public RenderingHints getRenderingHints(); }

  • Optional<T>
slide-40
SLIDE 40

40

  • String

  • double

float

slide-41
SLIDE 41

41

  • #include <string.h>

char *strncpy(char *dst, char *src, size_t n); void bcopy (void *src, void *dst, size_t n);

  • int

long int

java.util.collections java.util.concurrent long delay, TimeUnit unit

slide-42
SLIDE 42

42

  • Duration

// Eleven (!) parameters including four consecutive ints HWND CreateWindow(LPCTSTR lpClassName, LPCTSTR lpWindowName, DWORD dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam);

slide-43
SLIDE 43

43

  • null

package java.awt.image; public interface BufferedImageOp { // Returns the rendering hints for this operation, // or null if no hints have been set. public RenderingHints getRenderingHints(); }

slide-44
SLIDE 44

44

– –

slide-45
SLIDE 45

45

– –

slide-46
SLIDE 46

46

public class Throwable { public void printStackTrace(PrintStream s); public StackTraceElement[] getStackTrace(); // Since 1.4 } public final class StackTraceElement { public String getFileName(); public int getLineNumber(); public String getClassName(); public String getMethodName(); public boolean isNativeMethod(); }

slide-47
SLIDE 47

47

  • // Bad – ambiguous overloading with different behaviors

public TreeSet(Collection<E> c); // Ignores order public TreeSet(SortedSet<E> s); // Respects order

slide-48
SLIDE 48

48

slide-49
SLIDE 49

49

  • private byte[] a = new byte[CHUNK_SIZE];

void processBuffer(ByteBuffer buf) { try { while (true) { buf.get(a); processBytes(a, CHUNK_SIZE); } } catch (BufferUnderflowException e) { int remaining = buf.remaining(); buf.get(a, 0, remaining); processBytes(a, remaining); } }

  • void threadGroup.enumerate(Thread[] list);
slide-50
SLIDE 50

50

  • try {

Foo f = (Foo) super.clone(); .... } catch (CloneNotSupportedException e) { // This can't happen, since we’re Cloneable throw new AssertionError(); }

slide-51
SLIDE 51

51

  • IllegalArgumentException

IllegalStateException

slide-52
SLIDE 52

52

  • IndexOutOfBoundsException

– – – public IndexOutOfBoundsException (int index)

slide-53
SLIDE 53

53

slide-54
SLIDE 54

54

slide-55
SLIDE 55

55

slide-56
SLIDE 56

56