• Stars
    star
    551
  • Rank 80,726 (Top 2 %)
  • Language
    Jupyter Notebook
  • License
    MIT License
  • Created almost 5 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A guide of modern Java (Java 17)

java-guide

A guide to modern Java (Java 17)

This guide is about learning Java from scratch if you know a bit of C or JavaScript.

This is a Work in progress, it should be ready when the next LTS of Java (Java 17) will be released. All the codes run with Java 14 with the preview features enabled.

Note: if you are looking to only what's new in Java 14 I have set of slides for that.

Content

  1. genesis.md
  2. basic_types.md
  3. methods.md
  4. jshell_vs_java.md
  5. numbers.md
  6. control_flow.md
  7. interface.md
  8. lambda.md
  9. list_and_map.md
  10. string_formatting.md
  11. class_and_encapsulation.md
  12. equals_hashCode_toString.md
  13. contract.md
  14. modifiable_vs_mutable.md
  15. null_and_optional.md
  16. inheritance.md
  17. exception.md
  18. enum.md
  19. nested_classes.md
  20. array.md
  21. implementing_interface.md
  22. generics.md
  23. wrapper.md
  24. variance.md
  25. limitation_of_generics.md
  26. stream.md
  27. collector.md
  28. data_structure.md
  29. sort.md

Using Java Shell (jshell)

Each chapter comes with executable examples that you can run using jshell.

To get the examples, just clone this repository

  git clone http://github.com/forax/java-guide

Then run jshell (at least Java 14 version)

   jshell --enable-preview

Then you can copy paste the examples inside jshell and see by yourself.

To quit use '/exit', to enable verbose error messages '/set feedback verbose', otherwise to get the help type '/help'

Using Jupyter notebook

on the cloud

You can run it directly in your browser Binder

or using docker

You need to have docker already installed, then

  • get the docker image from dockerhub
      docker pull forax/java-guide
    
  • run the docker image in a container
      docker run -p 8888:8888 forax/java-guide
    
  • open your browser using the tokenId printed on the console
      firefox http://localhost:8888/?token=tokenId
    

or install everything on your laptop

You need to have python3 and Java 14 already installed, then

  • clone this repository
      git clone http://github.com/forax/java-guide
      cd java-guide
    
  • install jupyter
      pip install notebook
    
  • install the ijava 1.3.0 kernel (from Spencer Park)
    wget https://github.com/SpencerPark/IJava/releases/download/v1.3.0/ijava-1.3.0.zip
    python3 install.py --sys-prefix
    
  • patch it with the repository file kernel.json list all kernels to see if the java kernel is installed
    jupyter kernelspec list
    
    then copy the file kernel.json from the folder docker to the java kernel directory
    cp docker/kernel.json /path/to/jupyter/kernels/java
    
  • set the env compiler option enabling the preview features
    export IJAVA_COMPILER_OPTS="--enable-preview -source 14"
    
  • run the notebook
    cd jupyter
    jupyter notebook
    

Build markdown and jupyter files from jshell files

The markdown files (.md) and the jupyter files (.ipynb) are derived/generated from the jshell files using a small Java script.

Using java 14

  java --source 14 --enable-preview build/build.java

More Repositories

1

design-pattern-reloaded

Implementation of GoF design patterns using Java 21
Java
207
star
2

exotic

A bestiary of classes implementing exotic semantics in Java
Java
129
star
3

loom-fiber

Continuation & Fiber examples using the OpenJDK project Loom prototype
Java
116
star
4

pro

A Java build tool that works seamlessly with modules
Java
103
star
5

proxy2

Better / faster proxy generator than java.lang.reflect.Proxy for Java (require 1.7)
Java
69
star
6

beautiful_logger

Yet another logger API in Java with beautiful features
Java
65
star
7

record-util

Some utility classes around java records
Java
32
star
8

vector-handle

A high level API to express vectorized operations in Java
Java
25
star
9

kata-restrospective-11

Un kata sur comment utiliser Java 11 pour créer des APIs fonctionnelles
Java
25
star
10

macro

Java Macro Library
Java
23
star
11

moduletools

A small example of a Java 9 modular application
Java
20
star
12

kata-java17

A kata to transform an existing program to use Java 17 new features
Java
19
star
13

loom-actor

A small but fun actor framework based on loom
Java
19
star
14

mjolnir

Thor Hammer and a way to express invokedynamic in Java
Java
18
star
15

advent-of-code-2023

Let's try to do the advent of code 2023 in Java 21
Java
16
star
16

java-next

Binary builds of several OpenJDK projects
Shell
15
star
17

jexpress

A light express.js like library written in Java (in one file)
Java
15
star
18

vmboiler

A small library on top of ASM that generates optimistically typed bytecodes for dynamically typed JVM based languages
Java
14
star
19

write_your_dynamic_language_runtime

How to write interpreters or dynamic compilers for dynamically typed languages on top of the JVM
Java
13
star
20

hidden_proxy

A simple API that shows how,to use Hidden class to create proxies
Java
13
star
21

jayspec

RSpec for Java 8
Java
13
star
22

jsjs

jsjs is a JavaScript engine written in JavaScript on top of the Java Virtual Machine
Java
13
star
23

argvester

Argument Harvester - a simple command line parser
Java
12
star
24

blast_from_the_past

Evolution of Java on an example from 1.0 to 10
Java
12
star
25

write_your_own_java_framework_exercices

Try to implement small demos of the code powering usual Java frameworks
Java
11
star
26

write_your_own_java_framework

Understand how Spring, JakartaEE, Jackson, Guice and Hibernate works by rewriting a toy version of them
Java
11
star
27

do-synthetic-methods-dream-of-electric-switch-expressions

Slides for ParisJUG, ChtiJUG and DevoxxFR 2021
JavaScript
11
star
28

pratt_parser

Implementation of a Pratt Parser in Java
Java
9
star
29

einherjar

A Java tool that transforms a Java jar to an Einherjar to go to Valhalla
Java
9
star
30

valuetype-lworld

Tests of Java value type (lworld prototype)
Java
8
star
31

dragon

A simple enhanceable programming language for teaching algorithms
HTML
7
star
32

pro-demo

A small demo of pro
Java
6
star
33

we_are_all_to_gather

Demo of the new Stream Gatherer API of Java 22
Java
6
star
34

ninal

Ninal which stands for "Ninal is not a Lisp" is a small demo language (lisp like syntax/C like semantics) using Graal/Truffle
Java
5
star
35

jigsaw-jrtfs

A backport of jrtfs.jar for 1.7
Java
5
star
36

varhandle2

A safe yet efficient implementation of atomic operations for the JVM.
Java
5
star
37

tomahawk

A better Java API for Apache Arrow
Java
5
star
38

cplisp

A Lisp that is able to compile itself into the constant pool of a Java .class
Java
5
star
39

memory-mapper

A simpler API to the Foreign function memory API of Java
Java
5
star
40

indy-everywhere

A sample code that rewrite a folder of classes to use invokedynamic instead of getfield/putfield/invokevirtual/invokeinterface
Java
5
star
41

how_to_stop_a_thread

Different ways in Java to stop a thread
Java
5
star
42

dop-examples

Data Oriented Programming Examples
Java
4
star
43

java-interpolation

variation around how to implement string interpolation in Java
Java
4
star
44

java-21-demo

Java 21 : Add some sparkle to your life
Java
4
star
45

forax.github.io

blog pages
JavaScript
4
star
46

amber-record

tests of the OpenJDK Amber record/sealed types
Java
4
star
47

smartass

A toy language used to explain how to implement a dynamic language on top of the JVM
Java
4
star
48

virtual-bean

A simple API to compose bean behavior based on annotations
Java
4
star
49

umldoc

Automatically generates documentation with the UML diagrams using either plantUML or mermaidjs
Java
4
star
50

snowcamp-demo

one JDK8 application used as demo to show how to migrate to JDK9
JavaScript
3
star
51

blog

A blog publisher (like Jekyll) written in Java and tailored for me
Java
3
star
52

record-map

A java.util.Map that mostly supports Map interface but use a record instead of Map.Entry
Java
3
star
53

swisstable

A Java implementation of the Swisstable algorithm
Java
3
star
54

struct-of-array

Two data structures with the API of an array of structs (AoS) and the internals of a struct of arrays (SoA)
Java
3
star
55

cheapcoverage

A demo on how to gather code coverage information on Java (Kotlin, Scala, etc) classfiles
Java
3
star
56

panama-vector

A workspace to test the vector API of the OpenJDK Panama project
Java
3
star
57

amber-deconstructor

A prototype of how deconstructor can work for Amber OpenJDK project
Java
3
star
58

java-25-demo

Demo of Java 25
Java
3
star
59

civilizer

A bytecode rewriter that provides value types and specialized generics on top of OpenJDK Valhalla early access build
Java
3
star
60

jruby-methodcall-optimizer

a proof of concept of an optimizer of bytecodes able to transform recognizable pattern to invokedynamic
Java
2
star
61

8to6

A retroweaver from Java 8 to Java 6 in order to run Java 8 code on Android !
Java
2
star
62

jsonjedi

parsing JSON with JDK8 lambdas
Java
2
star
63

panama-fastaccess

Java
2
star
64

jsonapi

Proposal implementation for a Light-Weight JSON API (JEP 198)
Java
2
star
65

zen

A simple graphic library in Java (on top of AWT)
Java
2
star
66

flexible-constructor

Examples of flexible constructors (JEP 447) and more recent JEPs
Java
2
star
67

switch-pattern-combinator

A prototype showing how to generte the bytecode for a switch on patterns
Java
1
star
68

switch-carrier

A study of the carrier factory for the destructuring switch
Java
1
star
69

parisjug2013

The code I have shown during Paris JUG session "In bed with ..." in september 2013
Java
1
star
70

lambda-perf

performance of various implementations of lambda-lib (future jdk8 API)
Java
1
star
71

graalvm-demo

A demo of all graal projects
Java
1
star
72

pattern-matching

Examples of pattern matching in Java
Java
1
star
73

webapp-java17

A example of a Spring project using Java 17
Java
1
star
74

kija

Kija is a small programming language to teach algorithmics
Java
1
star
75

foraxproof

An example of a tool that analyze bytecode (like findbugs)
Java
1
star
76

reducedjs

A reduced set of the JavaScript feature that can run fast on the JVM
1
star
77

amber-demo

Examples of features of the Amber OpenJDK project
Java
1
star
78

html-component

A very small library to define unmodifiable HTML/XML components
Java
1
star
79

movie_buddy

A movie buddy application for Devoxx 2014 (Vertx + Java8 lambda)
JavaScript
1
star
80

thread-stop-experiment

Let see if we can not use the Arena/Segment as a lightweight cross thread mechanism
1
star