All Questions
Tagged with array object-oriented
67 questions
3
votes
1
answer
91
views
Merge discrete integer intervals
What it does
The code starts with a set of integer intervals, and can add new intervals (possibly by updating existing intervals). Essentially, it is a bit array whose index starts at ...
1
vote
1
answer
140
views
Transform an array into object and set index for an unique key in javascript
I have a method that merges keys and indexes from an array into an object.
I'm stuck with ways to compress this method, and I don't know what I can do to make it simpler.
Goal
get an array of objects ...
2
votes
1
answer
389
views
Generating random number of randomly sized Squares/Rectangles using numpy arrays
I made classes to use in generating square/rectangular shapes on a texture.
...
1
vote
1
answer
418
views
Best way to cherry pick objects from array of objects
With this data I am returning one object per keyword prioritising preferedDomain string on domain and then its higher ...
2
votes
2
answers
125
views
Complex Filter in one Opration
I am working on a Data-based application.
I wrote a code to filter the table.
The table has String and Numbers.
I some filter ...
2
votes
0
answers
54
views
editing the array I've included instead of editing the file of included array php
In order to reduce time complexity, instead of loading (and then dumping to use it for later) the whole file into an array (It would be O(n) with n=number of lines), I have saved it as array into a ...
6
votes
2
answers
503
views
Usage of Factory pattern for maintaing bookshelf having books, magazine and notes
I have tried to achieve the following task using Factory Pattern with PHP version 7.0.
Define the classes and their methods (including parameters and return types) for a system that consist of a ...
2
votes
2
answers
47
views
Combine data from array of objects
I got this data structure and I am checking to see which properties are true, then I am adding the key for all the properties that are true to that object on a new ...
1
vote
2
answers
767
views
Recursively find data in array of objects
On this script I look up properties in an array of objects. There is an original array of strings list to get the objects that match the ...
1
vote
1
answer
4k
views
Add / Overwrite an object in an array
I am trying to overwrite an object in an array if the title property exists, otherwise just push it to the array. I found two approaches and I wonder which one is ...
6
votes
1
answer
357
views
JavaScript: A drawing program in OOP
I made a little drawing program in OOP.
The game consists of a canvas which is basically a 2d array where the user can draw various shapes on it. There can be multiple shapes overlapped on top of each ...
1
vote
1
answer
105
views
JavaScript, looping, and functional approach
Data Structure coming back from the server
...
5
votes
1
answer
12k
views
React hooks update array of object
I have declared a react hook which will contain an array of object as follows:
const [rowDataTracker, setRowDataTracker] = useState([]);
Now I need to update the ...
3
votes
1
answer
55
views
Iterating an Array Object & Assigning the Attributes Values to those that Match the Condition
Is there any approaches to reduce the below coding snippet in Angular 2+ with few lines of code by making use of ECMA Script or by some other ways
...
2
votes
2
answers
315
views
Console dice game
I wrote a simple dice game with the purpose to practice arrays and classes. I would like some critique on my code structure and quality - as well as thoughts on my thoughts to improve it.
Here's the ...