Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Codecrew
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
30
Merge Requests
2
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 65949db8
authored
Sep 22, 2018
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get(0) from Map<String,?> will return always null, not the first entry...
1 parent
d638c6d2
Pipeline
#82
failed
in 0 seconds
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
code/moya-database/src/main/java/fi/codecrew/moya/model/LanguageAwareString.java
code/moya-database/src/main/java/fi/codecrew/moya/model/LanguageAwareString.java
View file @
65949db
...
...
@@ -2,6 +2,7 @@ package fi.codecrew.moya.model;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.Map
;
public
class
LanguageAwareString
{
...
...
@@ -9,7 +10,6 @@ public class LanguageAwareString {
private
Map
<
String
,
String
>
values
=
new
HashMap
<>();
public
String
getValue
(
String
language
)
{
if
(
values
.
isEmpty
())
{
return
null
;
...
...
@@ -20,12 +20,16 @@ public class LanguageAwareString {
ret
=
values
.
get
(
defaultLanguage
);
// If everything else fails, get a random entry from the map.
if
(
ret
==
null
)
{
ret
=
values
.
get
(
0
);
Iterator
<
String
>
rndIter
=
values
.
values
().
iterator
();
if
(
rndIter
.
hasNext
())
{
ret
=
rndIter
.
next
();
}
}
}
return
ret
;
}
public
String
getDefaultValue
(){
public
String
getDefaultValue
()
{
return
getValue
(
defaultLanguage
);
}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment