Disclosure of Invention
In order to at least solve the above problems in the prior art, the present invention provides a method and a system for performing inter-set conversion based on java language, so as to improve the conversion efficiency between sets.
The technical scheme provided by the invention is as follows:
in one aspect, a method for inter-set conversion based on java language includes:
acquiring a set conversion instruction, wherein the set conversion instruction comprises a set to be converted and a target set;
calling a set conversion method corresponding to the set conversion instruction through Collection.Concert;
and converting the set to be converted into the target set by using the set conversion method.
Optionally, before the obtaining the set conversion instruction, the method further includes:
acquiring a basic class set;
establishing a conversion method between the basic class sets;
and encapsulating the mutual conversion method of the basic class sets in Collection.
Optionally, the basic class set includes: map, List, and Set.
Optionally, after the set to be converted is converted into the target set by using the set conversion method, the method further includes:
and returning the target set to a user operation interface.
In another aspect, a system for inter-set conversion based on java language includes:
the system comprises an acquisition module, a conversion module and a conversion module, wherein the acquisition module is used for acquiring a set conversion instruction, and the set conversion instruction comprises a set to be converted and a target set;
a calling module, configured to call, through collection.concert, a collection conversion method corresponding to the collection conversion instruction;
and the conversion module is used for converting the set to be converted into the target set by using the set conversion method.
Optionally, the system for performing inter-set interconversion based on java language further includes an encapsulation module, which is specifically configured to:
acquiring a basic class set;
establishing a conversion method between the basic class sets;
and encapsulating the mutual conversion method of the basic class sets in Collection.
Optionally, the basic class set includes: map, List, and Set.
Optionally, the system for performing inter-set interconversion based on java language further includes a return module, which is specifically configured to:
and returning the target set to a user operation interface.
The invention has the beneficial effects that:
the invention provides a method and a system for mutual conversion among sets based on java language, wherein the method comprises the following steps: acquiring a set conversion instruction, wherein the set conversion instruction comprises a set to be converted and a target set; calling a set conversion method corresponding to the set conversion instruction through Collection.concert; the set to be converted is converted into the target set by using the set conversion method, and all conversion methods are packaged in the collection.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be described in detail below. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the examples given herein without any inventive step, are within the scope of the present invention.
Fig. 1 is a flowchart of a method for inter-set conversion based on java language according to an embodiment of the present invention.
As shown in fig. 1, the method for performing inter-set conversion based on java language provided in this embodiment includes the following steps:
s11, acquiring a set conversion instruction, wherein the set conversion instruction comprises a set to be converted and a target set.
The set conversion instruction is that a user comprises a set to be converted and a target set, wherein the set to be converted is combined, namely, a set required to be converted, the target set refers to a required set type, and the set to be converted is required to be converted into the target set.
And S12, calling a set conversion method corresponding to the set conversion instruction through Collection.
Specifically, before the combination conversion is performed, a basic class set is obtained; then, a method for converting the basic class sets is established, that is, the mutual conversion among all the sets is established, and finally, the method for converting the basic class sets is encapsulated in collection. Then, after the set conversion instruction is acquired, a set conversion method corresponding to the set conversion instruction is directly searched in collection. Wherein, the basic class set generally comprises: map, List, and Set.
And S13, converting the set to be converted into a target set by using a set conversion method.
After the corresponding set conversion method is obtained, the set to be converted can be directly converted into the target set by using the set conversion method. Therefore, the mutual conversion among the sets can be rapidly carried out, the data in the sets are directly transferred to the other set through a calling method, and the mutual conversion among the sets can be rapidly completed without rewriting codes.
The method and system for performing inter-set interconversion based on java language provided by the embodiment comprises the following steps: acquiring a set conversion instruction, wherein the set conversion instruction comprises a set to be converted and a target set; calling a set conversion method corresponding to the set conversion instruction through Collection.concert; the set to be converted is converted into the target set by using the set conversion method, and all conversion methods are packaged in the collection.
Further, in this embodiment, after the set to be converted is converted into the target set by using the set conversion method, the method further includes: and returning the target set to the user operation interface, so that the obtained final conversion result can be directly returned to the operation interface, and the method is more intuitive and efficient.
Based on the same general inventive concept, the application also protects a system for mutual conversion between sets based on java language.
Fig. 2 is a schematic structural diagram of a system for inter-set conversion based on java language according to an embodiment of the present invention.
As shown in fig. 2, the system for performing inter-set conversion based on java language provided in this embodiment includes:
an obtaining module 10, configured to obtain a set conversion instruction, where the set conversion instruction includes a set to be converted and a target set;
a calling module 20, configured to call, through collection.concert, a collection conversion method corresponding to the collection conversion instruction;
and the conversion module 30 is configured to convert the set to be converted into the target set by using a set conversion method.
The system for performing inter-set conversion based on java language provided by this embodiment includes: acquiring a set conversion instruction, wherein the set conversion instruction comprises a set to be converted and a target set; calling a set conversion method corresponding to the set conversion instruction through Collection.concert; the set to be converted is converted into the target set by using the set conversion method, and all conversion methods are packaged in the collection.
Further, the system for performing inter-set conversion based on java language in this embodiment further includes an encapsulation module, which is specifically configured to:
acquiring a basic class set;
establishing a mutual conversion method of the basic class sets;
and encapsulating the conversion method of the basic class sets among each other in Collection.
Further, the basic class set in this embodiment includes: map, List, and Set.
Further, the system for performing inter-set conversion based on java language in this embodiment further includes a return module, which is specifically configured to return the target set to the user operation interface.
Embodiments of the apparatus parts have been described in detail in relation to corresponding method embodiments, and therefore will not be described in detail in relation to corresponding apparatus parts, which may be understood by reference to each other.
Embodiments of the present application provide a storage medium, where a computer program is stored, and when the computer program is executed by a processor, the method for controlling a novel multifunctional express cabinet according to any of the above embodiments is implemented.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.
It is understood that the same or similar parts in the above embodiments may be mutually referred to, and the same or similar parts in other embodiments may be referred to for the content which is not described in detail in some embodiments.
It should be noted that the terms "first," "second," and the like in the description of the present invention are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. Further, in the description of the present invention, the meaning of "a plurality" means at least two unless otherwise specified.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and alternate implementations are included within the scope of the preferred embodiment of the present invention in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present invention.
It should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., are intended to mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made to the above embodiments by those of ordinary skill in the art within the scope of the present invention.