Test 3 Flashcards
in a lower bounded super Number> you can only send Number or parents of Number to that list, but you can add any child or parent of Number to that list
When retrieving data from lowerBound you need to cast the get method, but when retrieving from lowerBound, there is no need, but only for the specific type, not childs.
java.nio.file.NoSuchFileException: test.txt
This exception will be thrown when the program tries to create a BufferedReader to read the file specified by the Path object.
java.nio.file.InvalidPathException : test.txt
This exception is thrown when the argument passed while creating Path object is invalid. For example, “c:c:test.txt”.
setSavepoint()
rollback()
c.rollback() is called. This will cause the whole transaction to rollback.
save point revierte hasta ese punto y no mas, si se elimina algo y luego se hace rollback, se reinicia todo lo que se hizo luego del savePoint
Solo con crear un nuevo fileWritter se crea un archivo, si no existe, si ya existe lo sobreescribe al menos que tenga en su constructor append: true
asd
Duration does not convert hours into days.
If call sort and the collection does not implement comparable and not send a comparator and use generics then not compile
Throws en los hijos solo pueden tirar checked que sean igual o hijas de las exceptiones de los padres , o tambien no pueden tirar nada
as
Files.isSameFile method doesn’t check the contents of the file. It is meant to check if the two path objects resolve to the same file or not
Files.copy method will copy the file test1.txt into test2.txt. If test2.txt doesn’t exist, it will be created.
ok
Remember that variables are not overridden.
All remove methods from deque or queue removes from the front
compareAndSet(expectedValue, newValue) is meant exactly for this purpose. It first checks if the current value is same as the expected value and if so, updates to the new value.
public final boolean compareAndSet(int expect, int update)
Atomically sets the value to the given updated value if the current value == the expected value.
Parameters: expect - the expected value update - the new value
Returns: true if successful. False return indicates that the actual value was not equal to the expected value.
Manipulating a stream doesn’t manipulate the backing source of the stream. Here, when you chain the sorted method to a stream, it returns a reference to a Stream that appears sorted. The original List which was used to create the stream will remain as it is.
maps worked the same way at generics that collection do
You can enable or disable assertions in the unnamed root (default)package (the one in the current directory) using the following commands: java -ea:… myPackage.myProgram java -da:… myPackage.myProgram
df
By default, Files.move method attempts to move the file to the target file, failing (throwing exepction) if the target file exists except if the source and target are the same file, in which case this method has no effect SAME AS FILES:COPY
However, when the CopyOption argument of the move method is StandardCopyOption.ATOMIC_MOVE, the operation is implementation dependent if the target file exists. The existing file could be replaced or an IOException could be thrown.
Map.Entry pollFirstEntry()
Removes and returns a key-value mapping associated with the least key in this map, or null if the map is empty.
Map.Entry pollLastEntry()
Removes and returns a key-value mapping associated with the greatest key in this map, or null if the map is empty.
NavigableMap tailMap(K fromKey, boolean inclusive) Returns a view of the portion of this map whose keys are greater than (or equal to, if inclusive is true) fromKey.
Note that the tailmap is backed by the original map so //LINE 4 affects the original map as well.
Files writer y FileOutputStream crean el archivo al nomas crear el objecto, sin necesidad de escribir nada
asd
Collectors.mapping vs Collectors.groupingBy
To collect into a Map that contains a single value by key (Map), use Collectors.toMap().
To collect into a Map that contains multiple values by key (Map>), use Collectors.groupingBy().
And mapping. converts the stream from one type to the other