Skip to content

Commit

Permalink
Add info about string interning in slide J.1.67 fix lunduniversity#783
Browse files Browse the repository at this point in the history
Please observe that this fix creates another issue, i.e. overfull vbox for slide J.1.67. Consider addressing this by creating new slide and restructuring text between J.1.67 and J.1.68 and this new slide.
  • Loading branch information
EliasAAradsson committed Jan 5, 2024
1 parent f3be639 commit 6066e26
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions slides/body/lect-wjava-body.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1831,6 +1831,11 @@
scala> "hej".compareTo("HEJ") // alla stora är 'före' alla små
scala> "HEJ".compareTo("hej")
\end{REPL}

\item Observera att \code{"hej" == "hej"} i Java ibland evalueras till \code{true}. Detta beror inte på att \code{==} testar innehållslikhet utan på något som kallas stränginternalisering (eng. \textit{string interning}). \\
Mer om stränginternalisering för den nyfikna: \\
\href{https://stackoverflow.com/questions/10578984/what-is-java-string-interning}{https://stackoverflow.com/questions/10578984/what-is-java-string-interning}

\end{itemize}

\href{http://docs.oracle.com/javase/8/docs/api/java/lang/String.html#compareTo-java.lang.String-}{docs.oracle.com/javase/8/docs/api/java/lang/String.html\#compareTo-java.lang.String-}
Expand Down

0 comments on commit 6066e26

Please sign in to comment.