Skip to content

Commit f2149dd

Browse files
authored
Merge branch 'master' into typos-grammar
2 parents 1f06e92 + b941e36 commit f2149dd

8 files changed

+20
-18
lines changed

data/part-10/1-handling-collections-as-streams.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ long numbersDivisibleByThree = inputs.stream()
503503
<!-- Virran metodit voi jakaa karkeasti kahteen eri ryhmään: virran (1) arvojen käsittelyyn tarkoitettuihin välioperaatioihin sekä (2) käsittelyn lopettaviin pääteoperaatiohin. Edellisessä esimerkissä nähdyt metodit `filter` ja `mapToInt` ovat välioperaatioita. Välioperaatiot palauttavat arvonaan virran, jonka käsittelyä voi jatkaa -- käytännössä välioperaatioita voi olla käytännössä ääretön määrä ketjutettuna peräkkäin (pisteellä eroteltuna). Toisaalta edellisessä esimerkissä nähty metodi `average` on pääteoperaatio. Pääteoperaatio palauttaa käsiteltävän arvon, joka luodaan esimerkiksi virran arvoista.
504504
505505
Alla olevassa kuvassa on kuvattu virran toimintaa. Lähtötilanteena (1) on lista, jossa on arvoja. Kun listalle kutsutaan `stream()`-metodia, (2) luodaan virta listan arvoista. Arvoja käsitellään tämän jälkeen yksitellen. Virran arvoja voidaan (3) rajata metodilla `filter`. Tämä poistaa virrasta ne arvot, jotka ovat rajauksen ulkopuolella. Virran metodilla `map` voidaan (4) muuntaa virrassa olevia arvoja muodosta toiseen. Metodi `collect` (5) kerää virrassa olevat arvot arvot sille annettuun kokoelmaan, esim. listalle. -->
506-
Stream methods can be roughly divided into two categories: (1) intermediate operations inteded for processing elements ​​and (2) terminal operations that end the processing of elements. Both of the `filter` and `mapToInt` methods shown in the previous example are intermediate operations. Intermediate operations return a value that can be further processed - you could, in practice, have an infinite number of intermediate operations chained sequentially (& separated by a dot). On the other hand, the `average` method seen in the previous example is a terminal operation. A terminal operation returns a value to be processed, which is formed from, for instance, stream elements.
506+
Stream methods can be roughly divided into two categories: (1) intermediate operations intended for processing elements ​​and (2) terminal operations that end the processing of elements. Both of the `filter` and `mapToInt` methods shown in the previous example are intermediate operations. Intermediate operations return a value that can be further processed - you could, in practice, have an infinite number of intermediate operations chained sequentially (& separated by a dot). On the other hand, the `average` method seen in the previous example is a terminal operation. A terminal operation returns a value to be processed, which is formed from, for instance, stream elements.
507507

508508
The figure below illustrates how a stream works. The starting point (1) is a list with values. When the `stream()` method is called on a list, (2) a stream of list values ​​is created. The values ​​are then dealt with individually. The stream values ​​can be (3) filtered by the `filter` method, which removes values ​​that fail to meet the condition from the stream. The stream's `map` method (4) can be used to map values ​​in a stream from one form to another. The `collect` method (5) collects the values ​​in a stream into a collection provided to it, such as a list.
509509

data/part-10/2-interface-comparable.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ The exercise template includes the class `Student`, which has a name. Implement
214214

215215
<!-- **Vinkki:** Opiskelijan nimi on String, ja String-luokka on itsessään `Comparable`. Voit hyödyntää String-luokan `compareTo`-metodia Opiskelija-luokan metodia toteuttaessasi. `String.compareTo` kohtelee kirjaimia eriarvoisesti kirjainkoon mukaan, ja tätä varten String-luokalla on myös metodi `compareToIgnoreCase` joka nimensä mukaisesti jättää kirjainkoon huomioimatta. Voit käyttää opiskelijoiden järjestämiseen kumpaa näistä haluat. -->
216216

217-
**Hint:** The name of the `Student` is a String, which implements `Comparable` itself. You may use its `compareTo` method when implementing the method for the `Student` class. Note that `String.compareTo()` also treats letters according to their size, while the `compareToIgnoreCase` method of the same class ignores the capitalization completely. You may either of these methods in the exercise.
217+
The name of the `Student` is a String, which implements `Comparable` itself. You may use its `compareTo` method when implementing the method for the `Student` class. Note that `String.compareTo()` also treats letters according to their size, while the `compareToIgnoreCase` method of the same class ignores the capitalization completely. You may either of these methods in the exercise.
218218

219219
</programming-exercise>
220220

data/part-12/2-arraylist-and-hashtable.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -769,9 +769,9 @@ public V get(K key) {
769769

770770
List<Pair<K, V>> valuesAtIndex = this.values[hashValue];
771771

772-
for (int i = 0; i < valuesAtINdex.size(); i++) {
772+
for (int i = 0; i < valuesAtIndex.size(); i++) {
773773
if (valuesAtIndex.value(i).getKey().equals(key)) {
774-
return valuesAtindex.value(i).getValue();
774+
return valuesAtIndex.value(i).getValue();
775775
}
776776
}
777777

@@ -843,11 +843,11 @@ public void add(K key, V value) {
843843
values[hashValue] = new List<>();
844844
}
845845

846-
List<Pari<K, V>> valuesAtindex = values[hashValue];
846+
List<Pari<K, V>> valuesAtIndex = values[hashValue];
847847

848848
int index = -1;
849849
for (int i = 0; i < valuesAtIndex.size(); i++) {
850-
if (valuesAtINdex.value(i).getKey().equals(key)) {
850+
if (valuesAtIndex.value(i).getKey().equals(key)) {
851851
index = i;
852852
break;
853853
}
@@ -937,7 +937,7 @@ public void add(K key, V value) {
937937
valuesAtIndex.add(new Pair<>(key, value));
938938
this.firstFreeIndex++;
939939
} else {
940-
valuesAtindex.value(index).setValue(value);
940+
valuesAtIndex.value(index).setValue(value);
941941
}
942942
}
943943
```
@@ -1246,7 +1246,7 @@ System.out.println("Hash map: the search took about " + hashMapSearch / 1000000
12461246
<sample-output>
12471247

12481248
List: the search took about 6284 milliseconds (6284420580 nanoseconds.)
1249-
Hajautustaulu: the search took about 0 milliseconds (805106 nanoseconds.)
1249+
Hash map: the search took about 0 milliseconds (805106 nanoseconds.)
12501250

12511251
</sample-output>
12521252

data/part-12/4-multidimensional-data.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ for (int row = 0; row < twoDimensionalArray.length; row++) {
8888

8989
<!-- Nyt tulostus näyttää seuraavalta: -->
9090

91-
Now the printout looks like this:
91+
The program output is as follows:
9292

9393
<sample-output>
9494

@@ -113,7 +113,7 @@ Create in the exercise base a method called `public static String arrayAsString(
113113

114114
<!-- Kertaa yhdeksännestä osasta StringBuilderin käyttö ennen tehtävän tekoa. Alla muutamia esimerkkejä metodin odotetusta toiminnasta. -->
115115

116-
Brush up on using StringBuilder in part nine before taking on this exercise. Below there are a few examples of how the method is expected to work.
116+
Brush up on using StringBuilder in part 10.3 before taking on this exercise. Below there are a few examples of how the method is expected to work.
117117

118118
<!-- ```java
119119
int rows = 2;
@@ -328,7 +328,9 @@ We can implement the same functionality using a hash table. Wouldn't a hash tabl
328328
<!-- Kun hajautustaulusta haetaan tietoa tietyllä avaimella, metodin hashCode perusteella selvitetään paikka, mistä tietoa haetaan. Samassa paikassa voi olla useampi value (listassa), jolloin haettavaa avainta verrataan jokaiseen listalla olevaan valueon equals-metodia käyttäen. Kun taulukosta haetaan valuea tietyllä avaimella -- eli indeksillä -- ei vastaavaa toiminnallisuutta tarvitse tehdä. Taulukossa joko on value tai valuea ei ole. Taulukkoon liittyy pieni tehokkuushyöty ohjelman suorituskyvyn kannalta. -->
329329
When we search for a value of a key from a hash table, we use the hashCode method to find the index to search from.
330330
There can be multiple values at the same index (on a list). Then we have to compare the key we want to find the value for to the key of each key-value pair on the list using the equals method.
331-
When we search for a a value of a key -- or index -- in an array, we do not have to do any of that.
331+
332+
When we search for a value of a key -- or index -- in an array, we do not have to do any of that.
333+
332334
An array either contains a certain value or it does not, so there is a small performance beneft on using arrays.
333335

334336
<!-- Tämä tehokkuushyöty kuitenkin tulee lisääntyneen virhealttiuden sekä työmäärän kustannuksella. Hajautustauluun on valmiiksi toteutettuna sisäisen taulukon kasvattaminen ja sen toiminnallisuutta on testattu hyvin laajasti. Taulukkoa käytettäessä tällaista etua ei ole -- uutta toiminnallisuutta toteuttaessa saattaa päätyä virheisiin, mikä kasvattaa työmäärää. Virheet ovat toki luonnollinen osa ohjelmistokehitystä. -->
@@ -337,7 +339,7 @@ Hash tables have tested and proven functionality for increasing the size of the
337339
However, errors are accepted and natural part of software development.
338340

339341
<!-- Kun ajattelemme muistin käyttöä, hajautustaululla voi olla -- tapauksesta riippuen -- pieni etu. Kun taulukko luodaan, muistista varataan heti tila koko taulukolle. Mikäli taulukon jokaiseen indeksiin ei tarvitse lisätä tietoa, on osa tästä tiedosta varattuna turhaan. Hajautustaululla taas tällaista muistin varaamista ei ennakkoon tehdä -- hajautustaulun kokoa kasvatetaan tarvittaessa. -->
340-
When we consider the memory usage, hash table might -- in some situations -- have some benefits.
342+
When we consider the memory usage, hash tables might -- in some situations -- have some benefits.
341343
When an array is created, enough memory for the whole array is allocated for it.
342344
If we do not have values in each element of the array, some of the memory stays unused.
343345
With hash tables this does not happen -- the size of the hash table is increased only when necessary.

data/part-13/1-graphical-user-interfaces.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ When the launch method is called, the method of the Application class creates a
108108

109109
<!-- Luo tehtäväpohjassa olevaan luokkaan graafinen käyttöliittymä, jonka otsikkona on "Sovellukseni". Sovelluksen tulee käynnistyä kun main-metodi suoritetaan. -->
110110

111-
Create a GUI app with the title "My first application". The App shou start when main method is executed
111+
Create a GUI app with the title "My first application". The app should start when the main method is executed.
112112

113113
</programming-exercise>
114114

@@ -200,4 +200,4 @@ Käyttöliittymän rakenne on siis lyhyesti seuraava. Ikkuna sisältää Scene-o
200200
UI components are added as "children" to the object responsible for setting them -- FlowPane. This has to do with a JavaFx design decision, whereby each object responsible for UI components may contain other objects responsible for UI components as well as actual UI components. This enables GUIs where the layout of the UI components depends on their location on the user interface. For example, menu items located at the top of a UI are usually placed side by side, while list items are placed one below the other.
201201

202202

203-
To briefly summarize, the UI structure is as follows. The window contains a Scene object. The Scene object contains the object responsible for the layout of the user-interface components. The object responsible for the component layout can contain both UI components and objects responsible for UI component layouts. ->
203+
To briefly summarize, the UI structure is as follows. The window contains a Scene object. The Scene object contains the object responsible for the layout of the user-interface components. The object responsible for the component layout can contain both UI components and objects responsible for UI component layouts.

data/part-13/5-multiple-views.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Thus far our graphical interfaces have always included only one view. Next, we'l
2626

2727
<!-- Yleisesti ottaen näkymät luodaan Scene-olion avulla, joiden välillä siirtyminen tapahtuu sovellukseen kytkettyjen tapahtumien avulla. Alla olevassa esimerkissä on luotu kaksi erillistä Scene-oliota, joista kummallakin on oma sisältö sekä sisältöön liittyvä tapahtuma. Alla Scene-olioihin ei ole erikseen liitetty käyttöliittymän asetteluun käytettyä komponenttia (esim. BorderPane), vaan kummassakin Scene-oliossa on täsmälleen yksi käyttöliittymäkomponentti. -->
2828

29-
Generally the views are created as Scene-objects and the transitioning between them happens with events bound to the application. The example below has to Scene objects which both have their own content and an event related to the content. Instead of having an object for laying out components (such as BorderPane) in the example Scene objects, both objects have just one user interface component.
29+
Generally the views are created as Scene-objects and the transitioning between them happens with events bound to the application. The example below has two Scene objects which both have their own content and an event related to the content. Instead of having an object for laying out components (such as BorderPane) in the example Scene objects, both objects have just one user interface component.
3030

3131

3232
```java

data/part-5/3-primitive-and-reference-variables.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public Nimi {
6161
``` -->
6262

6363
```java
64-
public Name {
64+
public class Name {
6565
private String name;
6666

6767
public Name(String name) {
@@ -122,7 +122,7 @@ public Nimi {
122122
``` -->
123123

124124
```java
125-
public Name {
125+
public class Name {
126126
private String name;
127127

128128
public Name(String name) {

data/part-7/1-programming-paradigms.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ The most common programming paradigms today are object-oriented programming, pro
3737

3838
<!-- Olio-ohjelmoinnissa käsiteltävä tieto esitetään luokkina, jotka kuvaavat ongelma-alueen käsitteitä sekä sovelluksen toimintalogiikkaa. Luokkiin määritellään metodit, jotka määräävät miten tietoa käsitellään. Ohjelman suorituksen aikana luokista luodaan olioita, jotka sisältävät ajonaikaisen tiedon, ja jotka myös vaikuttavat ohjelman suoritukseen: ohjelman suoritus etenee tyypillisesti olioihin liittyvien metodikutsujen kautta. Kuten joitakin viikkoja sitten totesimme, "ohjelma rakennetaan pienistä selkeistä yhteistoiminnassa olevista olioista". -->
3939

40-
In object-oriented programming, information is represented as classes that describe the concepts of the problem domain and the logic of the application. Classes define the methods that determine how information is handled. During program execution, classes are instantiated from objects that contain runtime information and that also have an effect on program execution: program execution typically proceeds through a series of method calls related to the objects. As mentioned a few weeks ago, "the program is built from small, clear, and cooperative entities."
40+
In object-oriented programming, information is represented as classes that describe the concepts of the problem domain and the logic of the application. Classes define the methods that determine how information is handled. During program execution, objects are instantiated from classes that contain runtime information and that also have an effect on program execution: program execution typically proceeds through a series of method calls related to the objects. As mentioned a few weeks ago, "the program is built from small, clear, and cooperative entities."
4141

4242
<!-- Olio-ohjelmoinnin perusideat eli tiedon ja sen käsittelyyn liittyvien toimintojen esittäminen luokkien ja olioiden avulla esiintyivät ensimmäisiä kertoja simulaatioiden rakentamiseen tarkoitetussa <a href="https://en.wikipedia.org/wiki/Simula" target="_blank" norel>Simula 67</a>:ssä sekä <a href="https://en.wikipedia.org/wiki/Smalltalk" target="_blank" norel>Smalltalk</a>-ohjelmointikielessä. Sen läpimurto tapahtui 1980-luvulla <a href="https://en.wikipedia.org/wiki/C%2B%2B" target="_blank" norel>C++</a>-ohjelmointikielen kautta ja siitä on muodostunut <a href="https://en.wikipedia.org/wiki/Java_(programming_language)" target="_blank" norel>Java</a>-ohjelmointikielen myötä yksi maailman eniten käytetty ohjelmointiparadigma. -->
4343

0 commit comments

Comments
 (0)