草庐IT

Conversion_Constructors

全部标签

java - 没有 getter/setters/toString/constructors 的清晰代码的 Lombok 替代方案

已结束。此问题不符合StackOverflowguidelines.它目前不接受答案。要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于StackOverflow来说是无关紧要的,因为它们往往会吸引固执己见的答案和垃圾邮件。相反,describetheproblem以及到目前为止为解决这个问题所做的工作。关闭8年前。Improvethisquestion你知道Lombok的替代品吗?使用Lombok,我们可以忘记使用getter和setter以及toString搞乱类。我想在我的项目中使用它,但是我想知道是否有更好的选择?我使用的是Java1.7,无法更改为1.8。

java - 不一致的 "possible lossy conversion from int to byte"编译时错误

检查以下代码片段:片段#1inta=20;intb=30;bytec=(a>b)?20:30;Error:incompatibletypes:possiblelossyconversionfrominttobytebytec=(a>b)?20:30;片段#2inta=20;intb=30;byteh1=70;bytec=(a>b)?20:h1;片段#3inta=20;intb=30;byteh1=70;byteh2=89;bytec=(a>b)?h1:h2;片段#4bytec=(true)?20:30;除了Snippet#1之外,所有这些都可以正常编译。这种行为如何合理?如果Snipp

java - 不一致的 "possible lossy conversion from int to byte"编译时错误

检查以下代码片段:片段#1inta=20;intb=30;bytec=(a>b)?20:30;Error:incompatibletypes:possiblelossyconversionfrominttobytebytec=(a>b)?20:30;片段#2inta=20;intb=30;byteh1=70;bytec=(a>b)?20:h1;片段#3inta=20;intb=30;byteh1=70;byteh2=89;bytec=(a>b)?h1:h2;片段#4bytec=(true)?20:30;除了Snippet#1之外,所有这些都可以正常编译。这种行为如何合理?如果Snipp

java - android studio 自动完成 : how to display constructors with parameters

eclipse中的autoComplete会显示所有带参数的构造函数,但Androidstudio不显示。例如在eclipse中看下面的截图,它显示了Intent类的所有构造函数。虽然在androidstudio中自动完成Intent类显示不带参数如下。如何在androidstudio中更改自动完成以显示所有带参数的构造函数? 最佳答案 我通常从Ctrl+P开始查看接受哪些参数(在我看来,自动猜测完成是容易出错的方式)。如果您想填写名称类型n,则会出现一个dropdown菜单,其中包含所有可用的variables/fields(等)

java - android studio 自动完成 : how to display constructors with parameters

eclipse中的autoComplete会显示所有带参数的构造函数,但Androidstudio不显示。例如在eclipse中看下面的截图,它显示了Intent类的所有构造函数。虽然在androidstudio中自动完成Intent类显示不带参数如下。如何在androidstudio中更改自动完成以显示所有带参数的构造函数? 最佳答案 我通常从Ctrl+P开始查看接受哪些参数(在我看来,自动猜测完成是容易出错的方式)。如果您想填写名称类型n,则会出现一个dropdown菜单,其中包含所有可用的variables/fields(等)

type-conversion - Kotlin 的 Double.toInt() 中使用了哪种方法,舍入还是截断?

开启theofficialAPIdoc,它说:ReturnsthevalueofthisnumberasanInt,whichmayinvolveroundingortruncation.我想要截断,但不确定。谁能解释一下可能涉及舍入或截断的确切含义?p.s.:在我的单元测试中,(1.7).toInt()为1,可能涉及截断。 最佳答案 Double.toInt()的KDoc简单地继承自Number.toInt(),为此,确切的含义是,它在具体的Number实现中定义如何将其转换为Int。在Kotlin中,Double操作遵循IEEE

sql-server - XPath fn :data in sql server causes Type conversion in expression may affect "CardinalityEstimate" in query plan choice

我有一个xml变量,其中包含一组我想在表中查找的ID。查询时我尝试了几个版本,但以下版本(根据我的测试)似乎是最快的:declare@idsxmlasxml(IdSchemaColelction)='505766458073460689464050'SELECT*FROMentityWHERE@idsXml.exist('/root/Id[data(.)=sql:column("id")]')=1问题是查询计划有以下警告“表达式中的类型转换(CONVERT_IMPLICIT(sql_variant,CONVERT_IMPLICIT(numeric(38,10),[xmlTest].[d

c++ - "Expected constructor, destructor, or type conversion before ' < ' token"

我遇到语法/解析错误,但我似乎找不到它。DataReader.h:11:error:expectedconstructor,destructor,ortypeconversionbefore'这里是DataReader.h:#include#include#include#ifndefDATA_H#defineDATA_H#include"Data.h"#endifvectorDataReader();//Thisisline11,wheretheerroris..这是.cpp文件:#include"DataReader.h"usingnamespacestd;vectorDataRe

C++ 编译 "error: expected constructor, destructor, or type conversion before ' =' token "

位于同一文件“foo.h”中的非常简单的代码:classXface{public:uint32_tm_tick;Xface(uint32_ttk){m_tick=tk;}}std::mapm;Xface*tmp;tmp=newXface(100);**//Error**m[1]=tmp;**//Error**tmp=newXface(200);**//Error**m[2]=tmp;**//Error**错误是错误:在“=”标记之前需要构造函数、析构函数或类型转换对于每个任务。 最佳答案 C++不是脚本语言。您可以在可执行代码块的范

c++ - 二进制 '==' : no operator found which takes a left-hand operand of type 'std::string' (or there is no acceptable conversion)

我正在编写一个比较std::strings的模板类函数。std::string是模板参数。我的问题是我无法用“==”运算符比较两个const字符串,然后我想我创建了两个非常量临时字符串变量来执行比较,但它仍然无法编译。不知道为什么。类VGraph被实例化为VGraphmyGraph;templatesize_tVGraph::find(constV&vert){Vtemp=vert;//(1)for(size_ti=0;i相关函数原型(prototype)templateconstV&VVertex::getVertex(); 最佳答案