immutable-array | primitive Java arrays backed by Direct Buffers | Runtime Evironment library
kandi X-RAY | immutable-array Summary
kandi X-RAY | immutable-array Summary
Read-only primitive Java arrays backed by Direct Buffers and indexed using 64-bit indexes.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Creates a long immutable array
- Clear the buffer
- Returns the inner index for the given long index
- Returns the outer index for the given long value
- Gets the ImmutableArrays
- Returns an array of buffers
- Perform an action for each value in the buffer
- Rescale the last internal buffer
- Append a long value to the end of the array
- Append a short value at the specified index
- Appends the specified float value
- Appends the specified double to this builder
- Gets the bit at the given index
- Gets the bit at the given index as a boolean
- Gets value as a long
- Gets the bitmask as a boolean
- The projecting result value as int
- Returns the value at the given index as a short
- The projecting result value as a float
- Appends a boolean value to this builder
- Append the value at the specified index
- Build an ImmutableArray
- Creates an immutable float array
- Build a short array
- Builds an immutable boolean array
- Creates an immutable double array
immutable-array Key Features
immutable-array Examples and Code Snippets
Community Discussions
Trending Discussions on immutable-array
QUESTION
TL;DR - What methods/properties/functionalities are available for immutable arrays [T]
(or any built in type)?
Long Version
I have been looking for basic functionality around built in types such as arrays [T]
but with not a lot of luck. I can find information around base library helper methods and higher level types but not base array info I cannot find.
Looking in the docs on smartcontracts.org
I can find very basic information about them. Such as:
https://smartcontracts.org/docs/language-guide/mutable-state.html#immutable-arrays https://smartcontracts.org/docs/language-guide/language-manual.html#exp-arrays
I need to find the length of arrays and what are the best ways of appending/modifying arrays. There are things in mo:base/Array
, but curious to all the built in functionality, if any.
https://github.com/dfinity/motoko-base/blob/master/src/Array.mo
My only guess is the [T]
is an Iter = { next : () -> ?T }
and that its using Iter.size()
. If thats the case then [T]
would need a next : () -> ?T
method, but I cant find where that is defined.
ANSWER
Answered 2022-Feb-23 at 19:50For basic functionality and types you need to take a look into motoko implementation (https://github.com/dfinity/motoko).
If you are interested in motoko types you can find it here: https://github.com/dfinity/motoko/blob/master/src/mo_types/type.ml
When it comes to Array's built in methods there are:
method Immutable array Mutable Array size ✅ ✅ get ✅ ✅ keys ✅ ✅ vals ✅ ✅ put ✅ ❌If you are interested a little bit more you can find some information here:
https://github.com/dfinity/motoko/blob/master/src/mo_interpreter/interpret.ml (Section (* Overloaded dot implementations *)
)
And here: https://github.com/dfinity/motoko/blob/master/src/prelude/internals.mo
Example of script utilising some of the built in methods.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install immutable-array
You can use immutable-array like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the immutable-array component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page