Section 1

Preview this deck

public

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

2

All-time users

2

Favorites

0

Last updated

1 year ago

Date created

Mar 1, 2020

Cards (634)

Section 1

(50 cards)

public

Front

The name of the class and the file name must match when the class is declared _______

Back

-cp

Front

// to compile javac ___ <classesPaths> -d <compilerOutputPath> <pathToSource>.java

Back

=

Front

The assignment operator is ___

Back

long

Front

____ numbers have 64 bits

Back

float

Front

Double numbers provide double the precision of a ______

Back

classesPaths

Front

// to compile javac -cp <_______> -d <compilerOutputPath> <pathToSource>.java

Back

+

Front

The unary operator that indicates a positive number

Back

.jar

Front

The classpath can include a .zip or _____ file

Back

import

Front

The ______ keyword defines other classes or groups of classes that you are using in your class

Back

String

Front

public class Simple { public static void main(____ args[]) }

Back

L

Front

Append an uppercase or lowercase _____ to specify a long number

Back

.java

Front

A Java class is described in a text file with a ______ extension

Back

byte

Front

______ range is -128 to +127 -- 8 bits

Back

classpath

Front

The default value of the _______ is the current working directory

Back

package

Front

Classes in the .zip or .jar files in the class path must be zipped with the path names that are derived from the directories formed by their _______ names

Back

static

Front

public class Simple { public ______ void main(String args[]) }

Back

braces

Front

Code blocks are defined in ________

Back

class

Front

The ______ keyword precedes the name of a class

Back

main

Front

public class Simple { public static void ____(String args[]) }

Back

compilerOutputPath

Front

// to compile java ___ <classesPaths> -d <_________> <pathToSource>.java

Back

-cp

Front

//to run app java ___ <classesPaths> <packageName>.<className>

Back

command

Front

_____-line arguments are passed to the program through the args[] array

Back

declarations

Front

Method _______ are enclosed in code blocks

Back

methods

Front

Functions that can be performed on an object

Back

*

Front

Multiplication operator

Back

class

Front

Java fields and methods have ______ scope

Back

block

Front

Every class declaration is enclosed in a code ______

Back

java

Front

//to run app ____ -cp <classesPaths> <packageName>.<className>

Back

CLASSPATH

Front

The _____ variable is used by both the Java compiler and the Java interpreter at runtime

Back

args[]

Front

public class Simple { public static void main(String _____) }

Back

underscore

Front

Any number of ______ characters can appear between digits in a numeric field

Back

+

Front

The additive operator and string concatenation operator

Back

main

Front

To run a Java program, you must define a _____ method

Back

root

Front

The directory containing the ____ name of the package tree must be added to the class path

Back

%

Front

Remainder operator

Back

.java

Front

// to compile java ___ <classesPaths> -d <compilerOutputPath> <pathToSource>______

Back

F

Front

Append an uppercase or lowercase _____ to specify a float number

Back

final

Front

The keyword ____ is used to declare a variable whose value may only be assigned once

Back

javac

Front

To compile a Java source file, use the Java compiler called _______

Back

pathToSource

Front

// to compile java -cp <classesPaths> -d <compilerOutputPath> <_________>.java

Back

directory

Front

The classpath can include a list of _______ names

Back

constructors

Front

Functions called during the creation of an object

Back

/

Front

Division operator

Back

modifier

Front

The keyword public in front of the class keyword is a ______ and not required

Back

short

Front

_____ range is -32,768 to +32,767 -- 16 bits

Back

int

Front

_____ rang is -2,147,483,648 to +2,147,483,647 -- 32 bits

Back

-d

Front

// to compile java -cp <classesPaths> __ <compilerOutputPath> <pathToSource>.java

Back

void

Front

public class Simple { public static ____ main(String args[]) }

Back

-

Front

The unary operator that indicates a expression negation

Back

instance

Front

Variables, or the data associated with programs are called ________ fields

Back

Section 2

(50 cards)

private

Front

One way to hide implementation details is to declare all of the fields _______

Back

for

Front

// for loop ____ (int i = 0; i < 9; i++) { System.out.println("" + i); }

Back

instanceof

Front

Compares an object to a specified type

Back

ClassName

Front

//build a constructor in a class public ________ () { }

Back

one

Front

There can only be ____ package declaration for a file

Back

primitive

Front

Java does not pass a reference to a ______, but rather a copy of the value

Back

parameters

Front

Constructors can take _______

Back

names

Front

//iterate over array of int int[] numbers = {100,200,300}; for (String name:____){ System.out.println("Name" + name); }

Back

new

Front

//creating StringBuilder StringBuilder sb = ___ StringBuilder("hello");

Back

default

Front

// switch statement _____ (color) { case "Blue": shirt = "Blue" + shirt; break; case "Red": shirt = "Red" + shirt; break; _____: shirt = "White" + shirt; System.out.println("" + shirt); }

Back

allocated

Front

When an object is instantiated by using the new keyword, memory is ______ for the object

Back

while

Front

// while loop _____ (x < 20) { System.out.print("x: " + x); x++; System.out.print("
"); }

Back

<=

Front

Less than or equal to

Back

StringBuilder

Front

//creating StringBuilder _______ sb = new StringBuilder("hello");

Back

()

Front

// while loop while _x < 20_ { System.out.print("x: " + x); x++; System.out.print("
"); }

Back

insert

Front

//how to insert sb._____(::number::, " Fine");

Back

append

Front

//adding to a StringBuilder instance StringBuilder sb = new StringBuilder("hello"); sb.______(", how are you?");

Back

private

Front

The ______ keyword, applied to fields and methods, allows access only to other methods within the class itself

Back

else

Front

// if statement if (a == b) { System.out.println("True"); } ____ { System.out.println("False"); }

Back

mutators

Front

Methods that set the value of each field are called ______

Back

!

Front

Operator to invert boolean value

Back

++

Front

Increment operator

Back

immutable

Front

Removing the setter methods and replacing the no-arg constructor guarantees that some fields can be ________

Back

130000.0

Front

//what does this return? public class ObjectPassTest { public static void main(String[] args) { ObjectPassTest test = new ObjectPassTest(); Employee x = new Employee(); x.setSalary(120_000.00); test.foo(x); System.out.println("" + x.getSalary()); } public void foo(Employee e){ e.setSalary(130_000.00); e = new Employee(); e.setSalary(140_000.00); } }

Back

memory

Front

For Java objects, the value of the right side of an assignment is a reference to ______ that stores a Java object

Back

new

Front

//create an instance ClassName cn = ___ ClassName();

Back

package

Front

The _______ keyword is used in Java to group classes together

Back

case

Front

// switch statement switch (color) { _____ "Blue": shirt = "Blue" + shirt; break; _____ "Red": shirt = "Red" + shirt; break; default: shirt = "White" + shirt; }

Back

++

Front

// for loop for (int i = 0; i < 9; i__) { System.out.println("" + i); }

Back

==

Front

Equal to

Back

name

Front

//iterate over array of int int[] numbers = {100,200,300}; for (String ____:names){ System.out.println("Name" + name); }

Back

immutable

Front

The String class is ________

Back

?:

Front

Ternary

Back

&&

Front

Conditional-AND

Back

reference

Front

For Java objects, the value of the right side of an assignment is a ________ to memory that stores a Java object

Back

if

Front

// if statement ____ (a == b) { System.out.println("True"); } else { System.out.println("False"); }

Back

public

Front

The _____ keyword allows any class in any package to access the field or method

Back

length

Front

//how to get a length of StringBuilder sb.______()

Back

>

Front

Greater than

Back

this

Front

//build a class accessor public void setId (int id) { ____.Id = id; }

Back

where

Front

The scope of an object reference depends on ______ the object is instantiated

Back

||

Front

Conditional-OR

Back

accessors

Front

Methods that get the value of each field are called ______

Back

switch

Front

// switch statement _____ (color) { case "Blue": shirt = "Blue" + shirt; break; case "Red": shirt = "Red" + shirt; break; default: shirt = "White" + shirt; }

Back

--

Front

decrement operator

Back

namespace

Front

A package is implemented as a folder and, like a folder, provides a _______ to a class //com.example.domain +com |_+example |_+domain |_+Employee.java |_+Manager.java

Back

value

Front

The Java language (unlike C++) uses pass-by-_______ for all assignment operations

Back

before

Front

You can guarantee that an instance is fully populated with data _____ it is a valid employee object

Back

;

Front

// for loop for (int i = 0_ i < 9_ i++) { System.out.println("" + i); }

Back

!=

Front

Not equal to

Back

Section 3

(50 cards)

runtime

Front

The behavior of an object is determined by its ______ reference

Back

Manager

Front

//make code compile public static void main(String[] args){ Employee e = new Manager(); if (e instanceof Manager){ Manager m = ( _____ ) e; m.setDeptName("HR"); System.out.println(m.getDetails()); } }

Back

setter

Front

In an immutable class ______ methods are not provided for variables

Back

inherited

Front

In Java, constructors are not _______ from the parent class

Back

default

Front

Keyword used when a data field or method can be accessed within the same class or package

Back

final

Front

//make a Singleton public class SingletonClass { private static ____ SingletonClass instance = new SingletonClass(); private SingletonClass() {} public static SingletonClass getInstance() { return instance; } }

Back

pattern

Front

Design ______ are reusable solutions to common software development problems

Back

overloading

Front

Two rules apply to ________ methods: (1) argument lists must differ (2) return types can be different

Back

final

Front

All fields of an immutable class should be final

Back

initializer

Front

The static _______ block is a code block prefixed by the static keyword //example static boolean[] switches = new boolean[5]; _____ { System.out.println(""); for (int i=0; i<5; i++) { switches[i] = true; } }

Back

constructors

Front

In addition to overloading methods, you can overload _________

Back

APIs

Front

Static methods are useful for ____ that are not object oriented

Back

variables

Front

Static initialization blocks are used to initialize static _______

Back

single

Front

The Java programming language permits a class to extend only one other class. This is called _____ inheritance

Back

new

Front

The overloaded constructor is called based upon the parameters specified when the ____ is executed

Back

hashcode

Front

The general contract for Object states that if two objects are considered equal (using the equals method, then the integer _______ returned for the two objects should also be equal

Back

inherit

Front

When an existing class is subclassed, the new class created is said to ______ the characteristics of the other class

Back

instanceof

Front

The Java language provides the ________ keyword to determine an object's class type at run time

Back

generic

Front

It is a good practice to design and write methods that take the most ______ form of your object possible

Back

subclassing

Front

In Java, _______ is used to define a new class in terms of an existing one

Back

shared

Front

Static variables are useful for containing _____ data

Back

methods

Front

static _____ can be called even if the class they are declared in has not been instantiated

Back

toString

Front

The ______ method returns a String representation of the object

Back

less

Front

The overriding method cannot be ____ accessible than the method in the parent class

Back

Static

Front

_____ variables are variable s that can be accessed even if the class they are declared in has not been instantiated

Back

protected

Front

Keyword used when access is extended to subclasses that reside in a package different from that class that owns the protected feature

Back

singleton

Front

The ______ design pattern details a class implementation that can be instantiated only once

Back

@Override

Front

This annotation is used to instruct compiler that method annotated with _________ is an overridden method from super class or interface

Back

initialization

Front

Static methods are commonly used in place of constructors to perform tasks related to object ________

Back

once

Front

Static initialization blocks are executed _____ when the class is loaded

Back

super

Front

The _____ keyword may also be used to invoke a parent's method or to access a parent's (nonprivate) field //example ______ (empId, name, ssn, salary);

Back

private

Front

In an immutable class all field are declared _____ so that direct access is not allowed

Back

final

Front

To make an immutable class in Java declare the class as ______ so it cannot be extended

Back

blocks

Front

A class can contain one or more static initializer _____

Back

static

Front

The _____ modifier is used to declare fields and methods as class-level resources

Back

import

Front

A static _____ statement makes the static members of a class available under their simple name //example _____ static java.lang.Math.random; import static java.lang.Math.*; public class StaticImport { public static void main(String[] args) { double d = random(); } }

Back

nontrivial

Front

Consider using static initializers when ______ code is required to initialize static variables

Back

order

Front

The blocks are called in the ___ that they appear in the source code

Back

downward

Front

For ______ casts, the compiler must be satisfied that the cast is possible

Back

loaded

Front

Static variables are initialized when the containing class is first ______

Back

extends

Front

The keyword _____ creates the inheritance relationship //example public class Manager ____ Employee { }

Back

private

Front

Keyword used when a data field or method can be accessed only within the same Java class

Back

Upward

Front

______ casts are always permitted and do not require a cast operator

Back

hashCode

Front

It is necessary to override the ______ method whenever this the equals method is overridden

Back

lang

Front

The root class of every Java class is java._____.Object

Back

public

Front

Keyword used when you want fields and methods accessible anywhere in the class, package, subclasses and any other class

Back

all

Front

With static variables ___ objects instances share a single copy of any static variables

Back

different

Front

Qualify the location of the method with a class name if the method is located in a ______ class than the caller

Back

same

Front

If there are two objects x and y in any class, x is equal to y if and only if x and y refer to the ____ object

Back

...

Front

//make this varargs friendly public class Statistics { public float average(int___ nums) { int sum = 0; for (int x: nums) { sum += x; } return ((float) sum / nums.length } }

Back

Section 4

(50 cards)

runtime

Front

With enums no range checking overhead is incurred at ________

Back

encapsulation

Front

One benefit of using nested classes is increased __________ . Members can be declared private while still granting access to another nested "helper" class

Back

sub

Front

An abstract class can be ___classed

Back

helper

Front

Nested classes allow you to limit utilization of a _____ class to the enclosing top-level class

Back

declared

Front

Final fields (instance variables) must be either of the following: assigned a value when ________

Back

specialized

Front

Subclasses may not need to inherit a method implementation the method is __________

Back

static

Front

_________ nested classes can be instantiated before the enclosing outer class and, therefore, are denied access to all non static members of the enclosing class

Back

common

Front

Coding to a ______ base type allows for the introduction of new subclasses with little or no modification of any code that depends on the more generic base type

Back

fields

Front

Enums can have _____, methods and private constructors

Back

local

Front

Final variables can be ______ variables

Back

cannot

Front

An abstract class _______ be instantiated

Back

synchronization

Front

A benefit of immutable classes in Java is that an immutable object can boost performance of Java application by reducing ________ in code

Back

constructor

Front

In an immutable class all fields are initialized via a constructor

Back

public

Front

Interfaces are similar to abstract classes containing only _____ abstract methods

Back

return

Front

An abstract method can take arguments and _______ values

Back

threads

Front

The immutable nature of final variables eliminates any of the concerns that come with concurrent access by multiple ______

Back

compile

Front

Enumerations provide a ______-time range check

Back

static

Front

The ______ modifier can be combined with final to create an always-available, never-changing variable

Back

cache

Front

You can _____ immutable object and reuse them, much like String literals and integers

Back

constant

Front

Interfaces can contain _____ fields

Back

GUI

Front

Nested classes are commonly used in applications with _____ elements

Back

private

Front

Enums can fields, methods , and ______ constructors.

Back

functionality

Front

Use abstract methods to outline ________ required in child classes

Back

pointing

Front

A final object reference only prevents a reference from _______ to another object

Back

abstract

Front

A class can be declared as abstract by using the ______ class-level modifier

Back

methods

Front

Enums can fields, ______ , and private constructors.

Back

arguments

Front

An abstract method can take ______ and return values

Back

switch

Front

Enums can be used as the expression in a ______ statement

Back

overridden

Front

An abstract method is ________ in subclasses

Back

constructor

Front

Final fields (instance variables) must be either of the following: assigned a value in every _________

Back

abstract

Front

A method can be declared as abstract by using the __________ method-level modifier

Back

thread

Front

A benefit of immutable classes in Java is that their objects by default are _____-safe, and can be shared without synchronization in concurrent environment

Back

classes

Front

Final ______ may not be extended

Back

new

Front

You may not instantiate an enum instance with ____

Back

constant

Front

A field that is both static and final is considered a _______

Back

body

Front

An abstract method cannot have a method _____

Back

parameters

Front

Final variables can be method ______

Back

Nesting

Front

_______ small classes within top-level classes places the code closer to where it is used

Back

inner

Front

An ______ nested class is considered part of the outer class and inherits access to all the private members of the outer class

Back

enum

Front

//make an enumeration public _____ PowerState { OFF, ON, SUSPEND; }

Back

methods

Front

When inheriting from an abstract class, you must do either of the following: (1) Declare the child class as abstract (2) Override all abstract ______ inherited from the parent class.

Back

nested

Front

A ______ class is a class declared within the body of another class

Back

initialized

Front

Final variables may not change their values after they are _______

Back

class

Front

Interfaces outline methods that must be implemented by a _____

Back

child

Front

When inheriting from an abstract class, you must do either of the following: (1) Declare the _______ class as abstract (2) Override all abstract methods inherited from the parent class.

Back

final

Front

_______ methods may not be overriden

Back

method

Front

An abstract _______ must be declared in an abstract class

Back

braces

Front

No _______ are allowed when defining an abstract method

Back

abstract

Front

Java interfaces are used to define _____ types

Back

together

Front

If a class is useful to only one other class, then it is logical to embed it in that class and keep the two ______

Back

Section 5

(50 cards)

collection

Front

A _______ is a single object designed to manage a group of objects

Back

generic

Front

//example of a _______ class public class CacheAny<T> { private T t; public void add(T t) { this.t = t; } public T get() { return this.t; } }

Back

ArrayList

Front

Two implementations of the List interface are (1) _______ , (2) LinkedList

Back

comma

Front

A class can implement more than one interface in a _____-separated list at the end of the class declaration

Back

arrow

Front

The lambda expression is an argument list, the _____ token, and then a block or expression

Back

LinkedHashSet

Front

Three implementations of the Set interface are (1) TreeSet (2) HashSet (3) _________

Back

generics

Front

_________ provide flexible type safety to your code, reduce the need for casting with collections and move many common errors from run time to compile time

Back

elements

Front

List allows duplicate _______

Back

elements

Front

Objects in a collection are called ______

Back

types

Front

With generics, S and U are used if there are second or third ______

Back

block

Front

The lambda expression is an argument list, the arrow token, and then a _____ or expression

Back

List

Front

_____ is an ordered collection of elements

Back

new

Front

//Make an Anonymous inner class Z04Analyzer.searchArr(strList01, ___ StringAnalyzer() { @Override public boolean analyze(String target, String searchStr) { return target.contains(searchStr); } } });

Back

interface

Front

Any class that implements an interface can be referenced by using that ________

Back

HashTable

Front

Three implementations of the Map interface are (1) HashMap (2) ______ (3) TreeMap

Back

adding

Front

List behaviors include (1) ____ elements at a specific index (2) Getting an element based on an index (3) Removing an element based on an index (4) Overwriting an element based on an index (5) Getting the size of the list

Back

interfaces

Front

List, Set and Map are _______ in Java

Back

extend

Front

Interfaces can _______ interfaces

Back

LinkedList

Front

Two implementations of the List interface are (1) ArrayList (2) _______

Back

default

Front

In an interface the ______ keyword allows you to provide fully implemented methods to all implementing classes

Back

argument

Front

The lambda expression is an ______ list, the arrow token, and then a block or expression

Back

element

Front

With generics, E means ______

Back

harming

Front

Default methods can be added or changed without ______ API hierarchies

Back

methods

Front

You may not declare ______ as private or protected in an interface

Back

util

Front

The Collections classes are all stored in the java.____ package.

Back

cache

Front

//example of a simple ______ class public class CacheString { private String message; public void add(String message){ this.message = message; } public String get(){ return this.message; } }

Back

type

Front

With generics, T means _____

Back

right

Front

When instantiating a generic class there is no need to repeat types on the _____ side of the statement //example CacheAny<String> myMessage = new CacheAny<>();

Back

lambda

Front

A ______ expression can be substituted for an anonymous inner class

Back

HashMap

Front

Three implementations of the Map interface are (1) ______ (2) HashTable (3) TreeMap

Back

List

Front

______ behaviors include (1) adding elements at a specific index (2) Getting an element based on an index (3) Removing an element based on an index (4) Overwriting an element based on an index (5) Getting the size of the list

Back

field

Front

When you declare a _____ in an interface, it is implicitly public, static and final

Back

value

Front

With generics, V means _____

Back

<String>

Front

//Write generic of the following CacheString myMessage = new CacheString(); CacheAny_____ myGenericMessage = new CacheAny_____();

Back

extends

Front

If you use both extends and implements, ________ must come first

Back

expression

Front

The lambda expression is an argument list, the arrow token, and then a block or ________

Back

abstract

Front

Because all methods are implicitly abstract in an interface it is redundant to use the _____ modifier

Back

methods

Front

Java 8 allows static ________ in an interface

Back

implementing

Front

A utility class that references that interface can prices any ______ class

Back

TreeMap

Front

Three implementations of the Map interface are (1) HashMap (2) HashTable (3) ________

Back

TreeSet

Front

Three implementations of the Set interface are (1) ______ (2) HashSet (3) LinkedHashSet

Back

can

Front

Interfaces _____ be used as a reference type

Back

primitives

Front

_______ are not allowed in a collection

Back

()

Front

//Write generic of the following CacheString myMessage = new CacheString(); CacheAny<String> myGenericMessage = new CacheAny<String>__;

Back

HashSet

Front

Three implementations of the Set interface are (1) TreeSet (2) ______ (3) LinkedHashSet

Back

key

Front

With generics, K means _____

Back

lambda

Front

______ expressions can be treated like variables

Back

boolean

Front

Lambda expressions have two variables and return a _______

Back

Collections

Front

The ______ API relies heavily on generics for its implementation

Back

ArrayDeque

Front

The implementation of Deque is ________

Back

Section 6

(50 cards)

Unbox

Front

//_____ Integer collection for (Integer partNumberObj:partList) { int partNumber = partNumberObj; System.out.println("Part number: " + partNumber); }

Back

Deque

Front

A collection that can be used as a stack or a queue

Back

variable

Front

//use of lambdas as a ______ Predicate<Person> allPilots = p -> p.getAge() >= 23 && p.getAge() <= 65; p1.stream().filter(allPilots).forEach(p -> rob.roboCall(p));

Back

Value

Front

In a Map interface the ______ is stored in the element associated with the key

Back

Key

Front

In a Map interface the ______ is a unique identifier for each element in a collection

Back

TreeMap

Front

//implement a TreeMap public class MapExample { public static void main(String[] args) { Map<String, String> partList = new ______<>(); //.... } }

Back

index

Front

In an ArrayList elements can be overwritten and accessed or inserted based on _______

Back

<>

Front

//implement a TreeMap public class MapExample { public static void main(String[] args) { Map<String, String> partList = new TreeMap__(); //.... } }

Back

positive

Front

In a Comparable interface implementation if the return number is ________ the parameter comes after the current element

Back

zero

Front

In a Comparable interface implementation if the return number is ________ the parameter is equal to the current element

Back

ArrayDeque

Front

//example of a _______ public class Teststack { public static void main(String[] args) { Deque<String> stack = new ________<>(); stack.push("one"); } }

Back

pipeline

Front

The Stream class converts a collection to a _______

Back

zero

Front

A stream pipeline consists of a source, ____ or more intermediate operations or one terminal operation //example tList.stream().filter(t -> t.getState().equals("CA")).forEach(SalesTxn::printSummary);

Back

iterate

Front

You can ______ through Set elements to access them

Back

add

Front

A queue provides FIFO (first in, first out) operations with ____(e) and remove() methods

Back

stream

Front

The ______ method opens up a whole host of new operations on collections //example p1._____().filter(p -> p.Age() >= 23).forEach(p -> rob.roboCall(p));

Back

primitives

Front

Auto boxing and unboxing are useful for moving between objects and _______

Back

Builder

Front

//example of the ______ pattern people.add( new Person.______() .givenName("Betty") .surName("Jones") .age(85) .gender(Gender.FEMALE) );

Back

removing

Front

List behaviors include (1) adding elements at a specific index (2) Getting an element based on an index (3) ______ an element based on an index (4) Overwriting an element based on an index (5) Getting the size of the list

Back

queue

Front

A ______ provides FIFO (first in, first out) operations with add(e) and remove() methods

Back

::

Front

//make reference to a static method ContainingClass__staticMethodName

Back

chaining

Front

Using method _______ you can use multiple methods in one statement

Back

Map

Front

The _____ interface is a collection that stores multiple key-value pairs

Back

getting

Front

List behaviors include (1) adding elements at a specific index (2) _____ an element based on an index (3) Removing an element based on an index (4) Overwriting an element based on an index (5) Getting the size of the list

Back

stack

Front

A ______ provides LIFO (last in, first out) operations with push(e) and pop() methods

Back

Set

Front

A ______ is an interface that contains only unique elements and has no index

Back

Streams

Front

_______ are a sequence of elements on which various methods can be chained

Back

compare

Front

Comparator is implemented by using the ______ method

Back

sorting

Front

The Comparator interface enables you to create and use numerous ______ options

Back

parallel

Front

Streams can be serial or _____

Back

lambda

Front

Within a ______ expression you can use a method reference in the following situations: Reference to a static or instance method or in reference to a constructor (i.e. ClassName::new)

Back

overwriting

Front

List behaviors include (1) adding elements at a specific index (2) Getting an element based on an index (3) Removing an element based on an index (4) _______ an element based on an index (5) Getting the size of the list

Back

chain

Front

A _____ of operations can occur only once with a stream

Back

TreeSet

Front

Comparable and Comparator interfaces can be used with sorted collections, such as _______ and TreeMap

Back

source

Front

A stream pipeline consists of a ______, zero or more intermediate operations or one terminal operation

Back

()

Front

//implement a TreeMap public class MapExample { public static void main(String[] args) { Map<String, String> partList = new TreeMap<>__; //.... } }

Back

ArrayList

Front

The _______ list automatically grows if elements exceed initial size

Back

comparator

Front

The Comparator interface enables you to create multiple ________ classes

Back

negative

Front

In a Comparable interface implementation if the return number is ________ the parameter comes before the current element

Back

TreeSet

Front

Of the Set interfaces _______ provides a sorted implementation

Back

Comparable

Front

The _______ interface overrides the compareTo method and provides only one sort option

Back

deque

Front

A ______ is a "doubled-ended queue"

Back

predicate

Front

The filter method uses ________ lambdas to select items

Back

Streams

Front

_______ are immutable, can be serial, parallel and after their elements are consumed they are no longer available. Also, a chain of operations can occur only once with it.

Back

getting

Front

List behaviors include (1) adding elements at a specific index (2) Getting an element based on an index (3) Removing an element based on an index (4) Overwriting an element based on an index (5) _____ the size of the list

Back

remove

Front

A queue provides FIFO (first in, first out) operations with add(e) and _____() methods

Back

Comparator

Front

The _______ interface is implemented by using the compare method, enables you to create multiple _________ classes and enables you to create and use numerous sorting options

Back

<>

Front

//Use generics to add compile time check List partList = new ArrayList(3); List<Integer> partList = new ArrayList__(3);

Back

TreeMap

Front

Comparable and Comparator interfaces can be used with sorted collections, such as TreeSet and ________

Back

null

Front

A HashMap implementation justlike Hashtable except that it accepts ____ keys and values

Back

Section 7

(50 cards)

predicate

Front

A _______ is an expression that returns a boolean

Back

comparing

Front

The _______ method allows you to specify any field to sort on based on a method reference or lambda //_(Function<?superT,?extendsU> keyExtractor)

Back

min

Front

//in stream return smallest //element of this stream //according to Comparator __(Comparator<? super T> comparator)

Back

count

Front

In a stream pipeline the _______ method returns the number of elements in it

Back

invocations

Front

Nondeterministic search method results may vary between _______. Useful when employing parallelism.

Back

max

Front

//in stream return biggest //element of this stream //according to Comparator __(Comparator<? super T> comparator)

Back

Function

Front

//example of a ______ package java.util._____; public interface ______<T, R> { public R apply(T t); }

Back

double

Front

//complete primitive type return package java.util.function; public interface ToDoubleFunction<T> { public ____ applyAsDouble(T t); }

Back

supplier

Front

In the context of a stream this provides an instance of a T (such as a factory)

Back

findFirst

Front

In a stream pipeline the _____ short-circuit method returns the first element that meets the specified criteria

Back

predicate

Front

//example of _____ package java.util.function; public interface ______<T> { public boolean test(T t); }

Back

T

Front

//take class as input and return //object of the same class package java.util.function; public interface UnaryOperator<T> extends Function<T, T> { @Override public __ apply(T t); }

Back

extends

Front

//accept this & any child types ? ______ T

Back

allMatch

Front

In a stream pipeline the ______ short-circuit method returns true if all the elements meet the criteria

Back

consume

Front

Primitive interfaces can return and ______ a primitive

Back

intermediate

Front

The peek method is great for printing _______ results

Back

util

Front

Optional class is found in java.____

Back

optimized

Front

Lazy operations can be _______ and perform only required operations

Back

result

Front

A terminal operation in a store pipeline produces a _____ or side effect

Back

super

Front

//accept this & any parent types ? _____ T

Back

short-circuit

Front

//stream methods //each below is a Terminal ___ findFirst() --- findAny() --- anyMatch() --- allMatch() --- noneMatch()

Back

sorted

Front

In a stream the _____ method returns a stream consisting of the elements sorted according to natural order

Back

peek

Front

The ____ method performs the operation specified by the lambda expression and returns the elements to the stream. //code _(Consumer<? super T> action)

Back

noneMatch

Front

In a stream pipeline the _____ short-circuit method returns true if none of the elements meet the criteria

Back

R

Front

//process a primitive type package java.util.function; public interface DoubleFunction<R> { public __ apply(double value); }

Back

Primitive

Front

______ versions of map are mapToInt(), mapToLong(), mapToDouble()

Back

average

Front

In a stream pipeline the _____ method returns an optional describing the arithmetic mean of the stream elements

Back

Supplier

Front

//example of a _____ package java.util.function; public interface _______<T> { public T get(); }

Back

boolean

Front

//complete a BiPredicate package java.util.function; public interface BiPredicate<T, U> { public ______ test(T t, U u); }

Back

primitives

Front

OptionalDouble, OptionalInt and OptionalLong are Optional ________

Back

functional

Front

Lambda expressions rely on ______ interfaces

Back

consumer

Front

An expression that performs operations on an object passed as argument and has a void return type

Back

sum

Front

In a stream pipeline the ____ method returns the sum of elements in this stream

Back

return

Front

Primitive interfaces can ______ and consume a primitive

Back

consumer

Front

//example of a _____ ______<SalesTxn> buyer = t -> System.out.println("Id: " + t.getTxnId() + " Buyer: " + t.getBuyer().getName()); System.out.println("== Buyers - Lambda"); tList.stream().forEach(buyer); System.out.println("== First Buyer - Method"); buyer.accept(first);

Back

intermediate

Front

//stream methods //below: examples of _____ //operations filter() --- map() --- peek()

Back

map

Front

A ____ takes one Function as an argument. A Function takes one generic and returns something else //code ___(Function<? super T, ? extends R> mapper)

Back

function

Front

In the context of a stream this transforms a T to a U

Back

optional

Front

The findAny method returns an _______<T>

Back

findAny

Front

The nondeterministic search method _____ returns the first element found that meets the specified criteria

Back

Comparator

Front

//return sort according 2 comp sorted(______<? super T> comparator)

Back

side

Front

A terminal operation in a store pipeline produces a result or ____ effect

Back

thenComparing

Front

The _____ method can be added to the comparing method to do a multilevel sort on the elements in the stream

Back

terminal

Front

//stream methods //below: examples of ____ //operations forEach() --- count() --- sum() --- average() --- min() --- max() --- collect()

Back

isPresent

Front

In the Optional class if a value is present, _______ returns true

Back

get

Front

In the Optional class ____ returns the value

Back

optional

Front

A container object that may or may not contain a non-null value

Back

reversed

Front

The _____ method can be appended to a pipeline, thus reversing the sort order of the elements in the stream

Back

anyMatch

Front

The nondeterministic search method _____ returns true if any elements meet the criteria

Back

required

Front

Lazy operations can be optimized and perform only ______ operations

Back

Section 8

(50 cards)

IOException

Front

//complete try { in = new FileInputStream("missing file.txt"); } catch (______ e) { System.out.println(e.getMessage()); } finally { try { if(in != null) in.close(); } catch(IOException e) { System.out.println("Failed to close file"); } }

Back

Exception

Front

A catch clause is passed as a reference to a java.lang.____

Back

groupingBy

Front

The ______ method of the Collectors class operates on input elements of type T, grouping elements according to a classification function, and returning the results in a map //code _(Function<?superT,?extendsK>classifier)

Back

inheritance

Front

The type alternatives that are separated with vertical bars cannot have an _______ relationship

Back

throws

Front

Declaring an exception means to add a _______ clause to a method declaration, indicating that the method may fail to execute in a specific way.

Back

catch

Front

//complete try { InputStream in = new FileInputStream("missing file.txt"); } __ (Exception e) { System.out.println("Something went wrong"); }

Back

assertions

Front

Do not use ____ to check the parameters of a public method

Back

specific

Front

You should always catch the most ______ type of exception

Back

internal

Front

An _______ invariant is a "fact" that you believe to be true at a certain point in the program

Back

side

Front

Do not use methods that can cause _____ effects in the assertion check

Back

try-with-resources

Front

//example of _______ try(InputStream in = new FileInputStream("missing file.txt")) { System.out.println("File open"); int data = in.read(); } catch ...

Back

handling

Front

_______ a exception means that you must add in a code block to handle the error

Back

|

Front

//perform multi-catch try () { } catch (ClassNotFoundException _ IOException e) { System.out.println(); }

Back

class

Front

A _____ invariant is one that an object must satisfy in order to be a valid member of a class

Back

exception

Front

You may declare that a method throws an ______ instead of handling it

Back

Exception

Front

Sometimes the operation that you want to perform in your finally block may itself cause an ______ to be generated

Back

true

Front

An invariant is something that should always be ______

Back

Exception

Front

You can create custom exception classes by extending _____ or one of its subclasses

Back

flatMap

Front

Use the ____ method to flatten data in a stream. Can be used to convert data into a stream

Back

exception

Front

Declaring an ______ means that you declare that a method may fail to execute successfully

Back

try-catch

Front

Handling an exception means that you use a ________ statement to transfer control to an exception-handling block when an exception occurs.

Back

collect

Front

The ______ method allows you to save the result of a stream to a new data structure //example stream().collect(Collectors.toList());

Back

internal

Front

//ex. of __ invariant use int x = num; if (x > 0) { System.out.print("+"); } else if (x == 0) { System.out.print("0"); } else { assert (x > 0); }

Back

exception

Front

The throw statement is used to throw an instance of _______

Back

assertions

Front

Use _______ to document and verify the assumptions and internal logic of a single method

Back

assert

Front

//complete assertion _____ booleanExpression;

Back

close

Front

You always want to _____ open resources

Back

resources

Front

The try-with-______ statement is a try statement that declares one or more _______

Back

of

Front

The Stream.__ method allows you to easily create a stream //example Stream.of("Monday","Tuesday").filter(s -> s.startsWith("T")).forEach(s -> System.out.println("Matching Days: " + s));

Back

finally

Front

//complete try { in = new FileInputStream("missing file.txt"); } catch (IOException e) { System.out.println(e.getMessage()); } __ { try { if(in != null) in.close(); } catch(IOException e) { System.out.println("Failed to close file"); } }

Back

:

Front

//descriptive assertion assert booleanExpression _ expression;

Back

getMessage()

Front

When you only want to know what the error message is and do not want the full stack track use the _______ method

Back

control

Front

//ex. of ____ flow invariant switch(suit) { case Suit.CLUBS: // break; case Suit.DIAMONDS: // break; default: assert false: "Unknown"; break; }

Back

library

Front

Production-quality applications should use a logging _____ instead of printing debug message to the screen

Back

throws

Front

//complete public static int readByte() _____ IOException {...}

Back

control

Front

Errors can occur because of factors beyond the _____ of the application

Back

partitioningBy

Front

The _____ method of the Collectors class partitions the input elements according to a Predicate //code _(Predicates<?superT>predicate)

Back

finally

Front

A _______ clause runs regardless of whether or not an Exception was generated

Back

unchecked

Front

The two main categories of exceptions are checked exceptions, which must be "handled or declared" or ________ exceptions, which are not typically "handled or declared"

Back

Trace

Front

The method printStack____() helps to track down the cause of the exception

Back

applications

Front

Errors must be handled to create reliable ______

Back

Throwable

Front

The java.lang.____ class is the parent class for Exception and it outlines several methods that you may use.

Back

AutoCloseable

Front

Any class that implements java.lang._____ can be used as a resource

Back

handled

Front

The exceptions that methods may throw must still be ______

Back

averagingDouble

Front

The ______ method of the Collectors class produces the arithmetic mean of a double-valued function applied to the input elements //code averagingDouble(ToDoubleFunction<? super T> mapper)

Back

checked

Front

The two main categories of exceptions are ________ exceptions, which must be "handled or declared" or unchecked exceptions, which are not typically "handled or declared"

Back

errors

Front

_______ should be an exception and not the expected behavior

Back

try

Front

//complete __ { InputStream in = new FileInputStream("missing file.txt"); } catch (Exception e) { System.out.println("Something went wrong"); }

Back

multi

Front

The new ____-catch clause reduces the amount of code you must write by eliminating the need for many catch clause

Back

joining

Front

The ___ method of the Collectors class concatenates the input elements into a String, in encounter order

Back

Section 9

(50 cards)

Period

Front

________ is a class that holds a date-based amount

Back

close

Front

//auto closed in try-w-r void _____();

Back

System

Front

The _____ class in the java.lang package has three static instance fields: out, in, and err.

Back

ZoneOffset

Front

______: Extends ZoneId; specifies the actual time different from UTC

Back

LocalDate

Front

The java.time API defines two classes includes: (1) ______ (2) LocalTime

Back

skip

Front

//discard n bytes long ____(long n);

Back

LocalTime

Front

Questions that you can answer with _______: (1) When is my lunch time? (2) Is lunch time in the future or past? (3) What is the time 1 hour 15 minutes from now? (4) How many minutes until lunch time? (5) How many hours until bedtime? (6) How do I keep track of just the hours and minutes?

Back

ZoneId

Front

_______: is a specific location or offset relative to UTC

Back

files

Front

Typically, a developer uses input and output in three ways: (1) _____ and directories (2) console (3) socket-based sources

Back

byte

Front

Java technology supports two types of streams: character and _____

Back

LocalTime

Front

The java.time API defines two classes includes: (1) LocalDate (2) ______

Back

OffsetDateTime

Front

___________ class stores a LocalDateTime and ZoneOffset

Back

ZoneRules

Front

______: is the class used to determine offsets

Back

JDK

Front

Each time zone (ZoneID) has a set of rules that are part of the _____

Back

close

Front

//terminate open stream void ______();

Back

write

Front

//3 byte write methods void _(int c) void _(byte[] buffer) void _(byte[], int offSet, int length)

Back

Instant

Front

The ______ class stores an instant in time on the time-line

Back

socket

Front

Typically, a developer uses input and output in three ways: (1) files and directories (2) console (3) _____-based sources

Back

available

Front

//get bytes avail in stream int _______();

Back

new

Front

//chain streams FileReader //to BufferedFileReader try (BufferedReader bufInput = ___ BufferedReader(__ FileReader(args[0]));

Back

class

Front

//ex. of ____ invariant public class PersonClassInvariant { String name; String son; int age; private void checkAge() { assert age >= 18 && age < 150; } public void changeName(String fname) { checkAge(); name=fname; } }

Back

standard

Front

The System.out filed is a static instance of PrintStream object that enables you to write to _____ output

Back

LocalDateTime

Front

Questions you can answer the following questions with _______: (1) When is the meeting with corporate? (2) When does my flight leave? (3) When does the course start? (4) If I move the meeting to Friday, what is the date? (5) If the course starts at 9 AM on Monday and ends at 5 PM on Friday, how many hours am I in class?

Back

offset

Front

The three basic byte read methods are: (1) int read() (2) int read( byte[] buffer) (3) read(byte[] buffer, int _____, int length)

Back

one

Front

A program uses an input stream to read data from a source, ____ item at a time

Back

DateTimeFormatter

Front

________ produces formatted date/times

Back

from

Front

The System.in field is a static instance of an InputStream object that enables you to read ____ standard input

Back

ea

Front

//turn on assertions java -__ MyProgram

Back

streams

Front

Input and output of character data is handled by readers and writers in ________

Back

+=

Front

//count bytes read while ((read = fis.read(b)) != -1) { fos.write(b); count __ read; }

Back

LocalDateTime

Front

______ is a combination of LocalDate and LocalTime

Back

source

Front

An I/O stream represents an input _____ or an output destination

Back

destination

Front

An I/O stream represents an input source or an output _______

Back

PrintStream

Front

The println and print methods are part of the java.io._____ class

Back

character

Front

Java technology supports two types of streams: _______ and byte

Back

disabled

Front

If assertion checking is _____, the code runs as fast as it would if the check were not there

Back

byte

Front

Input and out of ____ data is handled by input streams and output streams

Back

byte[]

Front

The three basic byte read methods are: (1) int read() (2) int read( ____ buffer) (3) read(byte[] buffer, int offset, int length)

Back

err

Front

The System.___ field is a static instance of a PrintStream object that enables you to write to standard error

Back

console

Front

Typically, a developer uses input and output in three ways: (1) files and directories (2) _____ (3) socket-based sources

Back

TemporalUnit

Front

_____ is an interface representing a unit of time

Back

stream

Front

An I/O ______ can represent many different kinds of sources and destinations, including disk files, devices, other programs, and memory arrays

Back

()

Front

The three basic byte read methods are: (1) int read__ (2) int read(byte[] buffer) (3) read(byte[] buffer, int offset, int length)

Back

sink

Front

A program uses an output stream to write data to a ____, one item at time

Back

Duration

Front

_______ is a class that stores a time-based amount

Back

write

Front

//basic write void _(int c) void _(char[] cbuf) void _(char[] cbuf, int offset, int length) void _(String string) void _(String string, int offset, int length)

Back

LocalDate

Front

Questions that you can answer with _______: (1) Is it in the future or past? (2) Is it in a leap year? (3) What day of the week is it? (4) What is the day a month from now? (5) What is the date next Tuesday?

Back

I/O

Front

Java defines an ___ channel as a stream

Back

read

Front

//3 basic read methods int _() int _(char[] cbuf) int _(char[] chuff, int offset, int length)

Back

flush

Front

//force write to the stream void _____();

Back

Section 10

(50 cards)

interface

Front

The Path ______ is "link aware"

Back

transient

Front

Some object classes are not serializable because the represent ______ operating system-specific information

Back

one

Front

The element returned by endIndex is ___ less than the endIndex value

Back

isWritable

Front

//verify write access to file //using Files Class _______(Path)

Back

deserialization

Front

After _______ , the serialVersionUID is checked to verify that the classes loaded are compatible with the object being deserialized

Back

graph

Front

The tree of an object's fields constitutes the object _____

Back

overloaded

Front

The print and println methods are _______ for most primitive types and for char[], Object and String

Back

resolve

Front

The ____ method is used to combine two paths

Back

NotSerializableException

Front

If the object graph contains a non-serializable reference, a ________ is thrown and the serialization operation fails

Back

println

Front

The ____ methods print the argument and a newline character (
)

Back

detects

Front

Every Path method either: (1) ____ what to do when a symbolic link is encountered, or (2) Provides an option enabling you to configure the behavior when a symbolic link is encountered

Back

transient

Front

Fields that should not be serialized or that do not need to be serialized can be marked with the keyword ______

Back

relative

Front

A path is either _____ or absolute

Back

in

Front

//chain a buffered reader //to an input stream that //takes the console input try (BufferedReader in = new BufferedReader(new InputStreamReader(System.__)) { ... }

Back

toString

Front

The print and println methods call the ____ method on the argument

Back

serialVersionUID

Front

A serializable class can declare its own serialVersionUID by explicitly declaring a field named _______ as a static final and of type long

Back

symbolic

Front

Hard links are more restrictive than _____ links

Back

serialVersionUID

Front

During serialization, a version number, _________, is used to associate the serialized output with the class used in the serialization process

Back

serializable

Front

When a field reference an object, the fields of the referenced object are also serialized, if that object's class is also _______

Back

getPath

Front

To obtain a Path object, obtain an instance of the default file system, and then invoke the _____ method

Back

running

Front

A non-persisted object exists only as long as the Java Virtual Machine is _____

Back

Path

Front

The _____ interface defines the methods used to locate a file or a directory in a file system

Back

exists

Front

Before you can access a file or directory, you should first access the file system to determine whether it exists using the ______ Files methods

Back

aware

Front

Files class is also link _____

Back

Path

Front

java.nio.file.___: Locates a file or a directory by using a system-dependent path

Back

hard

Front

____ links are more restrictive than symbolic links

Back

FileSystem

Front

java.nio.file.____: Provides an interface to a file system and a factory for creating a Path and other objects that access a file system

Back

persistence

Front

Saving data to some type of permanent storage is called ________

Back

Path

Front

Use the _____ interface to operate on a path using: normalize, tours, toAbsolutePath, subpath, resolve, relativize

Back

Path

Front

The java.nio.file.____ interface provides the entry for the NIO.2 file and directory manipulation

Back

normalize

Front

The ______ method removes any redundant elements, which includes any "." or "directory/.." occurrences

Back

fields

Front

When an object is serialized, only the ____ of the object are preserved

Back

Path

Front

Static methods in the class read, write, and manipulate files and directories represented by _____ objects

Back

Files

Front

java.nio.file.Files: Using a Path, performs operations on files and directories

Back

own

Front

An object being serialized (and deserialized) can control the serialization of its ____ fields

Back

serialization

Front

Java _____ is the standard mechanism for saving an object as a sequence of bytes that can later be rebuilt into a copy of the object

Back

absolute

Front

A path is either relative or _________

Back

get

Front

Using the Path interface to access the components of a path use the following: __FileName, __Parent, __Root, __NameCount

Back

relative

Front

A ______ path must be combined with another path in order to access a file

Back

subpath

Front

A portion of a path can be obtained by creating a subpath using the _____ method: //example Path subpath(int beginIndex, int endIndex);

Back

print

Front

The ____ methods print the argument without a newline character

Back

Path

Front

Use the ____ interface to compare paths using: startsWith, endsWith, equals

Back

InvalidClassException

Front

If the receiver of a serialized object has loaded classes for that object with different serialVersionUID, deserialization will result in an ______________

Back

root

Front

An absolute path always contains the _____ element and the complete directory list required to locate the file

Back

Path

Front

A ______ object represents the concept of a file or a director location

Back

IOException

Front

All the methods that access the file system throw ______ or a subclass

Back

Files

Front

The java.nio.file._____ class is the primary entry point for operations on Path objects

Back

isReadable

Front

//verify read access to file //using Files Class _______(Path)

Back

provides

Front

Every Path method either: (1) detects what to do when a symbolic link is encountered, or (2) ____ an option enabling you to configure the behavior when a symbolic link is encountered

Back

io

Front

To serialize an object of a specific class, the class must implement the java.__.Serializable interface

Back

Section 11

(50 cards)

static

Front

____ synchronized methods use the classes' monitor

Back

Future

Front

The ___ interface is used to obtain the results from a Callable's V call() method //example __<V> ___ = es.submit(callable); try { V result = __.get(); } catch (ExecutionException|InterruptedException ex) { }

Back

ExecutorService

Front

An ________ is used to execute tasks

Back

process

Front

A _______ is an area of memory that contains both code and data

Back

readAllLines

Front

//load a file into an //ArrayList Files.___(file);

Back

operations

Front

_____ performed in one thread may not appear to execute in order if you observe the results from another thread

Back

concurrently

Front

Instance and static fields might be changed _______ by multiple threads

Back

ExecutorService

Front

Shutting down an ______ is important because its threads are nondaemon threads and will keep your JVM from shutting down

Back

Callable

Front

The ____ interface: (1) Defines a task submitted to an ExecutorService (2) Is similar in nature to Runnable, but can: Return a result using generics, throw a checked exception //example package java.util.concurrent; public interface __<V> { V call() throws Exception; }

Back

list

Front

//get a list of all of the files Files.__(Paths.get("."))

Back

delete

Front

//delete file/dir/link w/ //exceptions Files.__(path)

Back

this

Front

Synchronized methods use the monitor for the ______ object //example synchronized(___) { }

Back

starvation

Front

A situation where a thread attempts to access a resource that it can never access

Back

debugging

Front

__ threads can be difficult because the frequency and duration of time each thread is allocated can vary for many reasons

Back

lines

Front

//convert BufferedReader //into a stream bReader.____()

Back

multiple

Front

Classes should continue to behave correctly when accessed from _____ threads

Back

isExecutable

Front

//verify execute ability //using Files Class _______(Path)

Back

createFile

Front

//create a file Files._____(Path dir);

Back

working

Front

Every thread has a ______ memory in which it keeps its own copy of variables that it must use or assign

Back

move

Front

//change location of file/dir Files.__(src, trg, REP_EX);

Back

blocks

Front

Synchronized _____ must specify which object's monitor to lock or unlock

Back

deleteIfExists

Front

//delete file/dir/link w/ //no exceptions Files.___(path)

Back

CPUs

Front

Machines have different counts and speeds of ____

Back

isSameFile

Front

//verify method tests to //to see whether two paths //point to the same file ______(Path, Path)

Back

slice

Front

The amount of time each task is given

Back

walk

Front

//walk a dir structure Files.__(Paths.get("."))

Back

main

Front

There are several actions that will synchronize a thread's working memory the _____ memory: (1) A volatile read or write of a variable (2) locking or unlocking a monitor (3) the first and last action of a thread (4) actions that start a thread or detect that a thread has terminated

Back

shared

Front

Static and instance fields are potentially shared by threads

Back

synchronize

Front

To ensure consistent behavior in your threads, you must _____ their actions

Back

cached

Front

A ____ thread pool ExecutorService: (1) Creates new threads as needed (2) Reuses its threads (3) Terminates threads that have been idle for 60 seconds

Back

createDirectory

Front

//create a directory Files._____(Path dir);

Back

Runnable

Front

Tasks can be (1) java.lang._____ or java.util.concurrent.Callable

Back

heap

Front

Instance and static fields are created in an area of memory known as _____ space

Back

deadlock

Front

_____ is a situation where thread A is blocked waiting for a condition set by thread B, but thread B is also blocked waiting for a condition set by thread A

Back

createDirectories

Front

//create directories that //don/t exist, from top //to bottom Files.__(Paths.get("/home/foo/bar/example"));

Back

monitor

Front

Each object in Java is associated with a _______, which a thread can lock or unlock

Back

atomic

Front

A single statement in the Java language is not always ______

Back

livelock

Front

____ is a condition where a thread is not blocked, but cannot move forward because an operation it continually retries fails

Back

Callable

Front

Tasks can be (1) java.lang.Runnable or java.util.concurrent.___

Back

copy

Front

//replicate a file or dir Files.__(source, target, REPLACE_EXISTING, NOFOLLOW_LINKS);

Back

thread

Front

A _____ is a scheduled execution of a process

Back

get

Front

Because the call to Future.__() will block, you must do one of the following: (1) Submit all your work to the ExecutorService before calling any Future._() methods (2) Be prepared to wait for that Future to obtain the result (3) Use a non-blocking method such as Future.isDone() before calling Future.get() or use Future.get(long timeout, TimeUnit unit), which will throw a TimeoutException if the result is not available within a given duration

Back

scheduling

Front

Thread ____ is handled by an operating system and operating systems may use different scheduling algorithms

Back

Executors

Front

Implementing instances can be obtained with _____ //example ExecutorService es = ____.newCachedThreadPool();

Back

thread

Front

Because synchronized blocks and methods are used to restrict a section of code to a single _____, you are potentially creating performance bottlenecks

Back

symbolic

Front

A _____ link is a special file that serves as a reference to another file

Back

thread

Front

The following types are always are always ____-safe: (1) local variables (2) method parameters (3) exception handler parameters (4) immutable data

Back

fixed

Front

A ____ thread pool ExecutorService: (1) Contains a fixed number of threads (2) Reuses its threads (3) Queues up work until a thread is available (4) Could be used to avoid over working a system w/ CPU-intensive tasks

Back

synchronized

Front

The _____ keyword is used to create thread-safe code blocks

Back

block

Front

A synchronized code _____: (1) causes a thread to write all of its changes to main memory when the end of the block is reached (2) is used to group blocks of code for exclusive execution

Back

Section 12

(50 cards)

reduction

Front

An operation that takes a sequence of input elements and combines them into a single summary result by repeated application of a combining operation

Back

process

Front

The data being analyzed may require varying amounts to time to _____

Back

stateless

Front

//mutate the ____ way List<Employee> newList02 = new ArrayList<>(); newList02 = eList.parallelStream() .filter(e -> e.getDept().equals("Eng")) .collect(Collectors.toList());

Back

subsets

Front

To keep multiple threads busy each thread will have many ____ queued

Back

CPU

Front

Bottlenecks can occur when a single-threaded application uses only a single ___

Back

util

Front

The java.___ collections are not thread-safe

Back

lambda

Front

A stateful ____ is one whose result depends on any state which might change during the execution of the stream pipeline

Back

last

Front

Sequential and parallel methods may be called in a pipeline--whichever method is called ____, will be applied to the stream

Back

lock

Front

A thread can ____ multiple monitors simultaneously by using nested synchronized blocks

Back

threaded

Front

//single-_____ example //1 Gig int[] data = new int[10241024256]; for (int i = 0; i < data.length; i++) { data[i] = ThreadLocalRandom.current().nextInt(); } int max = Integer.MIN_VALUE; for (int value: data) { if (value > max) { max = value; } } System.out.println("Max value found:" + max);

Back

read

Front

Your data should be immutable or ____-only when used with stream pipelines

Back

stateful

Front

//mutate the ______ way //doesn't parallelize List<Employee> newList01 = new ArrayList<>(); eList.parallelStream().filter(e -> e.getDept().equals("Eng")) .forEach(e -> newList01.add(e));

Back

deterministic

Front

A ______ algorithm is an algorithm which, given a particular input, will always produce the same output //example ...paralle.().sum()

Back

deadlock

Front

//below will cause _____ synchronized(obj1) { synchronized(obj2) { ... } } synchronized(obj2) { synchronized(obj1) { ... } }

Back

ForkJoinTask

Front

A _______ typically creates more _______ instances until the data to processed has been subdivided adequately

Back

parallel

Front

A simple ____ solution breaks the data to be processed into multiple sets: one data set for each CPU and one thread to process each data set

Back

RecursiveTask

Front

With java.util.concurrent.ForkJoinTask<V>, when a task does need to return a result developers typically use a _________

Back

avoid

Front

When using Fork-Join, ____ I/O or blocking operations, know your hardware and know your problem

Back

work

Front

By subdividing the data to be precessed until there are more subsets than threads, we are facilitating "___-stealing."

Back

overhead

Front

Overly subdividing the data to be processed can cause unnecessary ______

Back

collections

Front

To use _____ in a thread-safe fashion: (1) use synchronized code blocks for all access to a collections if writes are performed (2) java.util.Collections.synchronizedList(List<T>) (3) Use the java.util.concurrent collections

Back

concurrent

Front

The java.util.___ package contains a numbers of classes that help with applications that are running at the same time

Back

divide

Front

To keep multiple threads busy _____ the data to be processed into a large number of subset

Back

different

Front

The larger the data set, the more likely the two code blocks will produce a _____ result

Back

stateless

Front

Operations parameters must be ______, this enables correct operation sequentially or in parallel. Best to banish side effects completely

Back

atomic

Front

java.util.concurrent.___ package will lock free thread-safe variables

Back

queue

Front

To keep multiple threads busy assign the data subsets to a thread's processing _____

Back

time

Front

Non-Java tasks require CPU _____

Back

streams

Front

Parallel _____ may provide better performance

Back

parallelStream

Front

//Make parallel stream double result = eList.____()

Back

power

Front

If you do not leverage threads in some way, only a portion of your system's processing ____ will be utilized

Back

ForkJoinTask

Front

A _______ object represents a task to be executed: (1)

Back

documentation

Front

When creating code to run inside of another piece of software you much read the product's ________ to discover whether threads will be created automatically

Back

Builders

Front

Stream pipelines are like _______

Back

different

Front

CPUs may run at ____ speeds

Back

RecursiveTask

Front

//__ example public class FindMaxTask extends ____<Integer> { private final int threshold; private final int[] myArray; private int start; private int end; public FindMaxTask(int[] myArray, int start, int end, int threshold) { // copy parameters to fields } protected Integer compute() { // shown later } }

Back

steal

Front

If a thread finishes all its subsets early, it can ____ subsets form another thread

Back

RecursiveAction

Front

With java.util.concurrent.ForkJoinTask<V>, when a task does not need to return a result developers typically use a _________

Back

CyclicBarrier

Front

The _____ is a class that blocks until a specified number of threads are waiting for the thread to complete

Back

optimal

Front

You must determine the _____ size of the work to add to each thread's processing queue.

Back

atomic

Front

There is no need to use the synchronized keyword with ____ variables

Back

Join

Front

A huge number of tasks are created and processed by a small number of threads in a Fork-___ pool

Back

ForkJoinPool

Front

A ______ is used to execute a ForkJoinTask. It creates a thread for each CPU in the system by default

Back

contention

Front

Resource _____ is when two or more tasks waiting for exclusive use of a resource

Back

subdividing

Front

Insufficiently ____ the data can result in underutilization of CPUs

Back

availableProcessor

Front

//detect number of //processors int count = Runtime.getRuntime().__();

Back

intensive

Front

If your tasks are compute-_____ as opposed to I/O _______, the number of parallel tasks should not greatly outnumber the number of processors in your system

Back

i/o

Front

Blocking ____ operations things can't happen because they are waiting for disk or network data transfer

Back

fork

Front

____/join is great, but too low level, has a lot of boilerplate code and stream uses ____/join under the hood

Back

associative

Front

If the combining function is ______, reduction parallelized cleanly //examples sum, min, max, average

Back

Section 13

(34 cards)

DateTimeFormatter

Front

Get a ______ object based on the Locale

Back

SQLException

Front

____ can be used to report details about resulting database errors

Back

DateTimeFormatter

Front

____ uses the FormatStyle enumeration to determine how the data is formatted

Back

DriverManager

Front

You can access them by following the sequence: (1) Use the _______ class to obtain a reference to a Connection object by using the getConnection method (2) Use the Connection object to obtain a reference to a Statement object through the createStatement method (3) Use the Statement object to obtain an instance of a ResultSet through an executeQuery method

Back

Statement

Front

You can access them by following the sequence: (1) Use the DriverManager class to obtain a reference to a Connection object by using the getConnection method (2) Use the Connection object to obtain a reference to a _____ object through the createStatement method (3) Use the Statement object to obtain an instance of a ResultSet through an executeQuery method

Back

executeQuery

Front

_____(sqlString) returns the SQL ResultSet and is used for SELECT statement

Back

ResourceBundle

Front

The ______ class isolates locale-specific data

Back

ResultSet

Front

//use the statement //instance to execute //SQL query ____ rs = stmt.executeQuery(query);

Back

driver

Front

//URL for a JDBC driver jdbc:<___>:[subsubprotocol:][databaseName][;attribute=value] //example String url = "jdbc:derby://localhost:1527/EmployeeDB";

Back

executeQuery

Front

//use a ResultSet object String query = "SELECT * FROM Employee"; ResultSet rs = stmt.___(query);

Back

currentLocale

Front

To change the Locale: set _______ to the desired language

Back

key

Front

Properties file contains a set of __-value pairs

Back

resources

Front

//try-with-___ try (Connection con = DriverManager.getConnection(url, username, password); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(query)){...}

Back

setXXX

Front

With PreparedStatement there is a _____ method for each type in the Java programming language

Back

subsubprotocol

Front

//URL for a JDBC driver jdbc:<driver>:[ _____:][databaseName][;attribute=value] //example String url = "jdbc:derby://localhost:1527/EmployeeDB";

Back

Locale

Front

A ______ specifies a particular language and country

Back

Properties

Front

The java.util._____ class is used to load and save key-value pairs in Java

Back

wrapper

Front

To execute SQL queries with JDBC, you must create a SQL query ____ object, an instance of the Statement object //example Statement stmt = con.createStatement();

Back

ResultSet

Front

Resources held by the _____ may not be released until garbage is collection, therefore, it is a good practice to explicitly close _______ objects when they are no longer needed

Back

databaseName

Front

//URL for a JDBC driver jdbc:<driver>:[ subsubprotocol:][ _______ ][;attribute=value] //example String url = "jdbc:derby://localhost:1527/EmployeeDB";

Back

Numbers

Front

_____ can be localized and displayed in their local format

Back

JDBC

Front

The _____ API is made up of some concrete classes, such as Date, Time, and SQLException and a set of interfaces that are implemented in a driver class that is provided by the database vendor

Back

CallableStatement

Front

A _______ allows non-SQL statement (such as stored procedures) to be executed against the database

Back

connection

Front

java.sql.Connection is a _____ that represents the session between your Java application and the database

Back

PreparedStatement

Front

____ is useful when you want to execute a SQL statement multiple times //example PreparedStatement pStmt = con.preparedStatement(query);

Back

execute

Front

The ____(sqlString) returns a boolean if (true if there was a ResultSet) and is used for any SQL command or commands

Back

executeUpdate

Front

The ______(sqlString) returns the number of rows affected and is used for INSERT, UPDATE, DELETE, or a DDL

Back

ResultSet

Front

You can access them by following the sequence: (1) Use the DriverManager class to obtain a reference to a Connection object by using the getConnection method (2) Use the Connection object to obtain a reference to a Statement object through the createStatement method (3) Use the Statement object to obtain an instance of a _____ through an executeQuery method

Back

Faster

Front

The ______ provides two additional benefits: (1) _____ execution (2) Parameterized SQL Statements

Back

attribute

Front

//URL for a JDBC driver jdbc:<driver>:[subsubprotocol:][databaseName][;____=value] //example String url = "jdbc:derby://localhost:1527/EmployeeDB";

Back

Statement

Front

java.sql.______ is an object used to execute a static SQL statement and return the result

Back

ResultSet

Front

java.sql._____ is an object representing a database result set

Back

Parameterized

Front

The ______ provides two additional benefits: (1) Faster execution (2) _____ SQL Statements

Back

associative

Front

______ means the order does not matter

Back