Reference
Java → Go
Filter state lives in the URL and is validated by the route, so this view is bookmarkable, shareable, and survives a refresh. Copy the address bar after filtering.
| note | ||
|---|---|---|
| int add(int a, int b) | func add(a, b int) int | types come AFTER names |
| void f() | func f() | no void — omit the return type |
| throws Exception / Pair<A,B> | func f() (int, error) | multiple return values are native |
| class Counter { int n; } | type Counter struct { n int } | struct, not class |
| void inc() { this.n++; } | func (c *Counter) inc() { c.n++ } | (c *Counter) is the receiver = explicit this |
| new Counter() | Counter{} / &Counter{} | composite literal, no constructors |
| new Point(1, 2) | Point{X: 1, Y: 2} | field names, not positions |
| class Foo implements Bar | (nothing) | interfaces are satisfied implicitly |
| public / package-private | Capitalized / lowercase | capitalization IS the access modifier |
| Math.max(a, b) | math.Max(a, b) | package-level func = Java static |
| package com.foo.store; | package store (in dir store/) | package == directory |
| import com.foo.*; | (illegal) | no wildcards; unused import = compile ERROR |
| pom.xml / jar | go.mod / no jars | import path is a URL |
| finally / try-with-resources | defer f.Close() | function-scoped, LIFO |
| new Thread() / virtual thread | go f() | goroutine, ~2KB growable stack |
| ExecutorService | (none needed) | the runtime is the scheduler |
| CountDownLatch | sync.WaitGroup | Add / Done / Wait |
| BlockingQueue | chan T | plus select for multiplexing |
| ThreadLocal / cancellation | context.Context | passed explicitly as the first arg |
| synchronized / ReentrantLock | sync.Mutex | no keyword, just a struct field |
| JFR / MAT heap dump | pprof + go tool trace | profile-based; no object graph |
| lambda () -> x | func() { x } | captures the VARIABLE, and it is mutable |
| JUnit + Maven surefire | go test ./... | built in; tests live next to the code |
| Optional<T> | (nothing) — use zero values / ok | v, ok := m[k] is the idiom |
24 of 24 rows