All Questions
Tagged with java data-structures
76 questions
2
votes
3
answers
166
views
Domain data classes with fluid property lists
Is it fine for your data models to have a sort of "open-ended" list of properties?
For example, you may have some Employee:
// getters, setters, annotations are omitted
public class Employee ...
2
votes
3
answers
965
views
Is breaking encapsulation a necessary compromise for serialization?
I've been considering the way to solve this problem for a while, and I'm currently stuck between two options I both feel are suboptimal. Here's an abstract example of what I'm dealing with:
I have a ...
3
votes
4
answers
1k
views
Representing vectors as arrays of points vs. as data structures
I'm writing a program in Java where I need to represent the position, scale, and other 3-dimensional properties of objects in a world using vectors.
I can use either of these two approaches:
...
-3
votes
1
answer
996
views
What's the right data structure to combine iteration of key-value pairs, and iteration of values
I'm looking for a pre-existing or easy-to-build data structure available in Java, which can do these 2 things efficiently:
Fetch all the values stored in the collection quickly.
Iterate over the data ...
0
votes
1
answer
96
views
Help required in the right data structure for faster look up of data
I have the below given data model
itemid - name - collectionitemid
example:
itemid |name | collectionItemId
-------------------------------
101 | abc | null
102 | def | 101
103 | ghi | 101
...
0
votes
1
answer
2k
views
Decouple business logic from DTO
I've to implement some Backend Webservices, which provide a given, final JSON structure, which is allready in use on the FrontEnd side.
This structure doesn't match the database structure, so I have ...
-2
votes
1
answer
678
views
Optimal Data Structure for Searching though String
I am current developing a karaoke app in JavaFX, I need advise on the most optimal data structure storing a huge list of songs (library). I am inclined to use Binary Search Trees due to its Big O ...
2
votes
2
answers
447
views
Tree data structure where children can only be added based on their type
I have a tree data structure where each node has a name, an id, a type and a number of children. Additionally each node has properties based on its type. Thereby each node with type A should only ...
1
vote
2
answers
179
views
How to manage item locations in an inventory
I have to manage item locations and life cycle as a new requirement. I'm not familiar in warehousing/inventory/storage systems, so maybe my question is trivial.
The task:
We have original items that ...
2
votes
2
answers
761
views
What are the "scalar fields" and "composite fields" in JAVA?
Need to understand the below definition, from the protobuf tutorial:
mergeFrom(Message other): (builder only) merges the contents of other into this message, overwriting singular scalar fields, ...
2
votes
1
answer
2k
views
Do we include output space in space complexity?
For example. I have a function which generates an array with random numbers.
int[] generateNum(int n) {
int[] result = new int[n];
/* Logic to generate random number */
...............
...
0
votes
1
answer
844
views
Efficiency in Java: Object reference vs id reference
I have to represent a certain data structure, in which I have nodes that are related between them. Each node has its numeric id, and a list containing the next directly related nodes and another list ...
-6
votes
1
answer
41
views
Give a list of a from area code and to area code and a distance between them,which data structure?
What data structure i can use to lookup given a fromCode and toCode apart from hashMap which results in more number of entries in the memory.
We are ok with log(n) efficiency also.
Example data:
...
2
votes
2
answers
1k
views
How to model JSON data so it can be easily de-serialized in to simple Java classes?
Context
Currently I'm struggling with correctly modeling a small instruction set I want to send as JSON to an Android application to generate a list of UI parts. Right now it's layered as pretty much ...
10
votes
3
answers
3k
views
Is it good practice to wrap a related set of properties into its own struct/class?
Writing a User object in Swift, though my question relates to any strongly typed language. A User can have a bunch of links (FacebookProfile, InstagramProfile, etc). A few questions around this.
Is ...